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.
Files changed (114) hide show
  1. package/dist/cli/ErrorHandler.d.ts +1 -1
  2. package/dist/cli/ErrorHandler.js +14 -14
  3. package/dist/cli/commands/bulk.d.ts +1 -1
  4. package/dist/cli/commands/bulk.d.ts.map +1 -1
  5. package/dist/cli/commands/bulk.js +51 -33
  6. package/dist/cli/commands/init.d.ts +1 -1
  7. package/dist/cli/commands/init.d.ts.map +1 -1
  8. package/dist/cli/commands/init.js +26 -18
  9. package/dist/cli/commands/showReport.d.ts +1 -1
  10. package/dist/cli/commands/showReport.d.ts.map +1 -1
  11. package/dist/cli/commands/showReport.js +12 -10
  12. package/dist/cli/commands/status.d.ts +1 -1
  13. package/dist/cli/commands/status.d.ts.map +1 -1
  14. package/dist/cli/commands/status.js +8 -8
  15. package/dist/cli/commands/sync.d.ts +1 -1
  16. package/dist/cli/commands/sync.d.ts.map +1 -1
  17. package/dist/cli/commands/sync.js +38 -30
  18. package/dist/cli/index.js +9 -9
  19. package/dist/cli/ui/DnaTable.d.ts +1 -1
  20. package/dist/cli/ui/DnaTable.d.ts.map +1 -1
  21. package/dist/cli/ui/DnaTable.js +23 -16
  22. package/dist/cli/ui/RefactorWizard.d.ts +3 -3
  23. package/dist/cli/ui/RefactorWizard.d.ts.map +1 -1
  24. package/dist/cli/ui/RefactorWizard.js +108 -82
  25. package/dist/config/ConfigLoader.d.ts +2 -2
  26. package/dist/config/ConfigLoader.d.ts.map +1 -1
  27. package/dist/config/ConfigLoader.js +15 -15
  28. package/dist/config/DryRunGuard.d.ts +1 -1
  29. package/dist/config/DryRunGuard.js +7 -7
  30. package/dist/config/SelaConfig.d.ts +12 -16
  31. package/dist/config/SelaConfig.d.ts.map +1 -1
  32. package/dist/config/SelaConfig.js +32 -26
  33. package/dist/engine/HealingRegistry.d.ts +1 -1
  34. package/dist/engine/HealingRegistry.js +3 -3
  35. package/dist/engine/SelaEngine.d.ts +1 -1
  36. package/dist/engine/SelaEngine.d.ts.map +1 -1
  37. package/dist/engine/SelaEngine.js +63 -49
  38. package/dist/errors/SelaError.d.ts +0 -1
  39. package/dist/errors/SelaError.d.ts.map +1 -1
  40. package/dist/errors/SelaError.js +6 -7
  41. package/dist/fixtures/expectProxy.d.ts +1 -1
  42. package/dist/fixtures/expectProxy.js +11 -11
  43. package/dist/fixtures/index.js +14 -14
  44. package/dist/fixtures/proxyTag.d.ts +1 -1
  45. package/dist/fixtures/proxyTag.js +3 -3
  46. package/dist/index.d.ts +8 -8
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +4 -4
  49. package/dist/reporter/SelaReporter.d.ts +45 -12
  50. package/dist/reporter/SelaReporter.d.ts.map +1 -1
  51. package/dist/reporter/SelaReporter.js +139 -39
  52. package/dist/services/ASTSourceUpdater.d.ts +3 -3
  53. package/dist/services/ASTSourceUpdater.d.ts.map +1 -1
  54. package/dist/services/ASTSourceUpdater.js +92 -68
  55. package/dist/services/ArgumentTypeAnalyzer.js +7 -7
  56. package/dist/services/BlastRadiusAnalyzer.d.ts.map +1 -1
  57. package/dist/services/BlastRadiusAnalyzer.js +5 -2
  58. package/dist/services/ChainValidator.js +22 -22
  59. package/dist/services/CrossFileHealer.js +7 -7
  60. package/dist/services/DefinitionTracer.d.ts +1 -1
  61. package/dist/services/DefinitionTracer.d.ts.map +1 -1
  62. package/dist/services/DefinitionTracer.js +28 -13
  63. package/dist/services/DnaEditorService.d.ts +2 -2
  64. package/dist/services/DnaEditorService.d.ts.map +1 -1
  65. package/dist/services/DnaEditorService.js +81 -62
  66. package/dist/services/DnaIndexService.d.ts +1 -1
  67. package/dist/services/DnaIndexService.d.ts.map +1 -1
  68. package/dist/services/DnaIndexService.js +14 -14
  69. package/dist/services/HealReportService.d.ts +6 -6
  70. package/dist/services/HealReportService.d.ts.map +1 -1
  71. package/dist/services/HealReportService.js +33 -29
  72. package/dist/services/HealingAdvisory.js +1 -1
  73. package/dist/services/HealingCacheService.d.ts +8 -8
  74. package/dist/services/HealingCacheService.d.ts.map +1 -1
  75. package/dist/services/HealingCacheService.js +24 -24
  76. package/dist/services/HealthReportService.d.ts +1 -1
  77. package/dist/services/HealthReportService.d.ts.map +1 -1
  78. package/dist/services/HealthReportService.js +25 -25
  79. package/dist/services/InitializerUpdater.js +2 -2
  80. package/dist/services/IntentAuditor.d.ts.map +1 -1
  81. package/dist/services/IntentAuditor.js +32 -21
  82. package/dist/services/InteractiveReview.d.ts +8 -17
  83. package/dist/services/InteractiveReview.d.ts.map +1 -1
  84. package/dist/services/InteractiveReview.js +31 -124
  85. package/dist/services/LLMService.d.ts +1 -1
  86. package/dist/services/LLMService.js +16 -16
  87. package/dist/services/PRAutomationService.d.ts +2 -2
  88. package/dist/services/PRAutomationService.d.ts.map +1 -1
  89. package/dist/services/PRAutomationService.js +43 -39
  90. package/dist/services/PendingPromptLedger.d.ts +2 -2
  91. package/dist/services/PendingPromptLedger.js +6 -6
  92. package/dist/services/ReportGenerator.d.ts +2 -2
  93. package/dist/services/ReportGenerator.d.ts.map +1 -1
  94. package/dist/services/ReportGenerator.js +5 -5
  95. package/dist/services/SafetyGuard.d.ts +3 -6
  96. package/dist/services/SafetyGuard.d.ts.map +1 -1
  97. package/dist/services/SafetyGuard.js +29 -106
  98. package/dist/services/SnapshotService.js +5 -5
  99. package/dist/services/SourceLinkService.d.ts +2 -2
  100. package/dist/services/SourceLinkService.d.ts.map +1 -1
  101. package/dist/services/SourceLinkService.js +31 -22
  102. package/dist/services/SourceUpdater.d.ts +1 -1
  103. package/dist/services/SourceUpdater.d.ts.map +1 -1
  104. package/dist/services/SourceUpdater.js +27 -26
  105. package/dist/services/TemplateDiffService.d.ts.map +1 -1
  106. package/dist/services/TemplateDiffService.js +18 -15
  107. package/dist/services/WorkspaceSnapshotService.d.ts +6 -6
  108. package/dist/services/WorkspaceSnapshotService.d.ts.map +1 -1
  109. package/dist/services/WorkspaceSnapshotService.js +10 -12
  110. package/dist/types/index.d.ts +1 -1
  111. package/dist/utils/IsolatedDiff.d.ts +2 -2
  112. package/dist/utils/IsolatedDiff.d.ts.map +1 -1
  113. package/dist/utils/IsolatedDiff.js +13 -10
  114. package/package.json +2 -2
package/dist/cli/index.js CHANGED
@@ -37,10 +37,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  const path = __importStar(require("path"));
38
38
  try {
39
39
  // eslint-disable-next-line @typescript-eslint/no-var-requires
40
- require('dotenv').config({ path: path.join(process.cwd(), '.env') });
40
+ require("dotenv").config({ path: path.join(process.cwd(), ".env") });
41
41
  }
42
42
  catch {
43
- // dotenv missing or .env absent continue silently
43
+ // dotenv missing or .env absent - continue silently
44
44
  }
45
45
  const commander_1 = require("commander");
46
46
  const ErrorHandler_js_1 = require("./ErrorHandler.js");
@@ -54,12 +54,12 @@ const sync_js_1 = require("./commands/sync.js");
54
54
  const showReport_js_1 = require("./commands/showReport.js");
55
55
  (0, ErrorHandler_js_1.registerGlobalHandlers)();
56
56
  // Diagnostic console.log from services (ConfigLoader etc.) → stderr so stdout stays pipe-clean
57
- console.log = (...args) => process.stderr.write(args.map(String).join(' ') + '\n');
57
+ console.log = (...args) => process.stderr.write(args.map(String).join(" ") + "\n");
58
58
  const program = new commander_1.Command();
59
59
  program
60
- .name('sela')
61
- .description('Sela CLI proactive DNA management for Fixwright')
62
- .version('1.0.3')
60
+ .name("sela")
61
+ .description("Sela CLI - proactive DNA management for Fixwright")
62
+ .version("1.0.3")
63
63
  .exitOverride(ErrorHandler_js_1.handleError)
64
64
  .configureOutput({ outputError: () => { } });
65
65
  // ── sela init ────────────────────────────────────────────────────────────────
@@ -68,11 +68,11 @@ program
68
68
  (0, status_js_1.registerStatus)(program);
69
69
  // ── sela list (T-07) ─────────────────────────────────────────────────────────
70
70
  (0, list_js_1.registerList)(program);
71
- // ── sela show-report open Sela Insights HTML ───────────────────────────────
71
+ // ── sela show-report - open Sela Insights HTML ───────────────────────────────
72
72
  (0, showReport_js_1.registerShowReport)(program);
73
73
  // ── sela dna <subcommand> ─────────────────────────────────────────────────────
74
- const dna = new commander_1.Command('dna')
75
- .description('DNA management commands')
74
+ const dna = new commander_1.Command("dna")
75
+ .description("DNA management commands")
76
76
  .exitOverride(ErrorHandler_js_1.handleError)
77
77
  .configureOutput({ outputError: () => { } });
78
78
  // ── sela dna find (T-08) ─────────────────────────────────────────────────────
@@ -1,3 +1,3 @@
1
- import type { DnaRecord } from '../../services/types.js';
1
+ import type { DnaRecord } from "../../services/types.js";
2
2
  export declare function renderTable(records: DnaRecord[]): string;
3
3
  //# sourceMappingURL=DnaTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DnaTable.d.ts","sourceRoot":"","sources":["../../../src/cli/ui/DnaTable.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAuCzD,wBAAgB,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,MAAM,CAoBxD"}
1
+ {"version":3,"file":"DnaTable.d.ts","sourceRoot":"","sources":["../../../src/cli/ui/DnaTable.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAkDzD,wBAAgB,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,MAAM,CAoBxD"}
@@ -8,17 +8,17 @@ const cli_table3_1 = __importDefault(require("cli-table3"));
8
8
  const chalk_1 = __importDefault(require("chalk"));
9
9
  const path_1 = __importDefault(require("path"));
10
10
  // Truncate before chalk so ANSI codes don't corrupt visual width calculations.
11
- function trunc(s, maxLen, fallback = '—') {
12
- if (s == null || s.trim() === '')
11
+ function trunc(s, maxLen, fallback = "-") {
12
+ if (s == null || s.trim() === "")
13
13
  return chalk_1.default.dim(fallback);
14
- return s.length <= maxLen ? s : s.slice(0, maxLen - 1) + '';
14
+ return s.length <= maxLen ? s : s.slice(0, maxLen - 1) + "";
15
15
  }
16
16
  function relativeTime(iso) {
17
17
  if (!iso)
18
- return chalk_1.default.dim('never');
18
+ return chalk_1.default.dim("never");
19
19
  const d = Math.floor((Date.now() - new Date(iso).getTime()) / 86_400_000);
20
20
  if (d === 0)
21
- return chalk_1.default.green('today');
21
+ return chalk_1.default.green("today");
22
22
  if (d < 7)
23
23
  return `${d}d ago`;
24
24
  if (d < 30)
@@ -27,26 +27,33 @@ function relativeTime(iso) {
27
27
  }
28
28
  function statusBadge(r) {
29
29
  if (r.isOrphaned)
30
- return chalk_1.default.red('orphaned');
31
- if (r.status === 'healed')
32
- return chalk_1.default.yellow('⚠ unverified');
33
- if (r.status === 'broken')
34
- return chalk_1.default.red('broken');
30
+ return chalk_1.default.red("orphaned");
31
+ if (r.status === "healed")
32
+ return chalk_1.default.yellow("⚠ unverified");
33
+ if (r.status === "broken")
34
+ return chalk_1.default.red("broken");
35
35
  if (r.lastHealed !== null)
36
- return chalk_1.default.green('healed');
37
- return chalk_1.default.cyan('active');
36
+ return chalk_1.default.green("healed");
37
+ return chalk_1.default.cyan("active");
38
38
  }
39
39
  function sourceCell(r) {
40
40
  if (!r.sourceFile)
41
- return chalk_1.default.dim('—');
41
+ return chalk_1.default.dim("-");
42
42
  const rel = path_1.default.relative(process.cwd(), r.sourceFile);
43
43
  const display = rel.length < r.sourceFile.length ? rel : r.sourceFile;
44
- const suffix = r.sourceLine > 0 ? `:${r.sourceLine}` : '';
44
+ const suffix = r.sourceLine > 0 ? `:${r.sourceLine}` : "";
45
45
  return trunc(display + suffix, 32);
46
46
  }
47
47
  // colWidths = content + 2 (1-space padding each side)
48
48
  const COLS = {
49
- head: ['Key', 'Test Title', 'Source : Line', 'Selector', 'Last Healed', 'Status'],
49
+ head: [
50
+ "Key",
51
+ "Test Title",
52
+ "Source : Line",
53
+ "Selector",
54
+ "Last Healed",
55
+ "Status",
56
+ ],
50
57
  colWidths: [11, 24, 36, 44, 13, 11],
51
58
  };
52
59
  function renderTable(records) {
@@ -54,7 +61,7 @@ function renderTable(records) {
54
61
  head: COLS.head.map((h) => chalk_1.default.bold(h)),
55
62
  colWidths: COLS.colWidths,
56
63
  wordWrap: false,
57
- style: { head: [], border: ['dim'] },
64
+ style: { head: [], border: ["dim"] },
58
65
  });
59
66
  for (const r of records) {
60
67
  table.push([
@@ -1,6 +1,6 @@
1
- import type { IDnaIndexService } from '../../services/DnaIndexService.js';
2
- import type { IDnaEditorService } from '../../services/DnaEditorService.js';
3
- import type { ISourceLinkService } from '../../services/SourceLinkService.js';
1
+ import type { IDnaIndexService } from "../../services/DnaIndexService.js";
2
+ import type { IDnaEditorService } from "../../services/DnaEditorService.js";
3
+ import type { ISourceLinkService } from "../../services/SourceLinkService.js";
4
4
  export interface WizardOptions {
5
5
  noSource?: boolean;
6
6
  dryRun?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"RefactorWizard.d.ts","sourceRoot":"","sources":["../../../src/cli/ui/RefactorWizard.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,oCAAoC,CAAC;AACjG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAM9E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,UAAU,cAAc;IACtB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,UAAU,EAAE,kBAAkB,CAAC;CAChC;AAwFD,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADJ,GAAG,EAAE,cAAc,EACnB,IAAI,GAAE,aAAkB;IAGrC,GAAG,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA4G7C,OAAO,CAAC,UAAU;YAUJ,SAAS;YAwBT,WAAW;YAgBX,SAAS;YAyBT,OAAO;IAKrB,OAAO,CAAC,aAAa;CAGtB"}
1
+ {"version":3,"file":"RefactorWizard.d.ts","sourceRoot":"","sources":["../../../src/cli/ui/RefactorWizard.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAM9E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,UAAU,cAAc;IACtB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,UAAU,EAAE,kBAAkB,CAAC;CAChC;AA6HD,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADJ,GAAG,EAAE,cAAc,EACnB,IAAI,GAAE,aAAkB;IAGrC,GAAG,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwH7C,OAAO,CAAC,UAAU;YAUJ,SAAS;YAwBT,WAAW;YA+BX,SAAS;YA4BT,OAAO;IAKrB,OAAO,CAAC,aAAa;CAMtB"}
@@ -11,15 +11,15 @@ const LocatorPicker_js_1 = require("./LocatorPicker.js");
11
11
  // ── Helpers ───────────────────────────────────────────────────────────────────
12
12
  function formatValue(v) {
13
13
  if (v === null || v === undefined)
14
- return chalk_1.default.dim('null');
15
- if (typeof v === 'object')
14
+ return chalk_1.default.dim("null");
15
+ if (typeof v === "object")
16
16
  return JSON.stringify(v, null, 2);
17
17
  return String(v);
18
18
  }
19
19
  function parseInput(field, raw) {
20
- if (field === 'text')
21
- return raw.trim() === '' ? null : raw;
22
- if (field === 'attributes' || field === 'anchors') {
20
+ if (field === "text")
21
+ return raw.trim() === "" ? null : raw;
22
+ if (field === "attributes" || field === "anchors") {
23
23
  try {
24
24
  return JSON.parse(raw);
25
25
  }
@@ -31,41 +31,46 @@ function parseInput(field, raw) {
31
31
  }
32
32
  function getFieldValue(field, record, snap) {
33
33
  switch (field) {
34
- case 'selector': return record.selector;
35
- case 'text': return record.text;
36
- case 'tagName': return record.tagName;
37
- case 'attributes': return snap.attributes;
38
- case 'anchors': return snap.anchors;
34
+ case "selector":
35
+ return record.selector;
36
+ case "text":
37
+ return record.text;
38
+ case "tagName":
39
+ return record.tagName;
40
+ case "attributes":
41
+ return snap.attributes;
42
+ case "anchors":
43
+ return snap.anchors;
39
44
  }
40
45
  }
41
46
  function validateField(field, value) {
42
47
  const errs = [];
43
48
  switch (field) {
44
- case 'selector':
45
- if (typeof value !== 'string' || value.trim() === '')
46
- errs.push('selector must not be empty');
47
- if (value === 'undefined')
49
+ case "selector":
50
+ if (typeof value !== "string" || value.trim() === "")
51
+ errs.push("selector must not be empty");
52
+ if (value === "undefined")
48
53
  errs.push('selector must not be the string "undefined"');
49
- if (typeof value === 'string' && /[\r\n]/.test(value))
50
- errs.push('selector must not contain raw newlines');
54
+ if (typeof value === "string" && /[\r\n]/.test(value))
55
+ errs.push("selector must not contain raw newlines");
51
56
  break;
52
- case 'text':
53
- if (value !== null && typeof value !== 'string')
54
- errs.push('text must be a string or null');
55
- if (typeof value === 'string' && value.length >= 2000)
56
- errs.push('text must be fewer than 2000 characters');
57
+ case "text":
58
+ if (value !== null && typeof value !== "string")
59
+ errs.push("text must be a string or null");
60
+ if (typeof value === "string" && value.length >= 2000)
61
+ errs.push("text must be fewer than 2000 characters");
57
62
  break;
58
- case 'tagName':
59
- if (typeof value !== 'string' || !/^[a-z][a-z0-9-]*$/.test(value))
60
- errs.push('tagName must match /^[a-z][a-z0-9-]*$/');
63
+ case "tagName":
64
+ if (typeof value !== "string" || !/^[a-z][a-z0-9-]*$/.test(value))
65
+ errs.push("tagName must match /^[a-z][a-z0-9-]*$/");
61
66
  break;
62
- case 'attributes':
63
- if (typeof value !== 'object' || value === null || Array.isArray(value))
64
- errs.push('attributes must be a plain object (JSON)');
67
+ case "attributes":
68
+ if (typeof value !== "object" || value === null || Array.isArray(value))
69
+ errs.push("attributes must be a plain object (JSON)");
65
70
  break;
66
- case 'anchors':
67
- if (typeof value !== 'object' || value === null)
68
- errs.push('anchors must be an object (JSON)');
71
+ case "anchors":
72
+ if (typeof value !== "object" || value === null)
73
+ errs.push("anchors must be an object (JSON)");
69
74
  break;
70
75
  }
71
76
  return errs;
@@ -74,28 +79,34 @@ function showRecordCard(record) {
74
79
  const w = 62;
75
80
  const line = (label, value) => {
76
81
  const content = ` ${chalk_1.default.dim(label.padEnd(14))} ${value}`;
77
- process.stdout.write(content + '\n');
82
+ process.stdout.write(content + "\n");
78
83
  };
79
- process.stdout.write('\n' + chalk_1.default.dim(''.repeat(w)) + '\n');
80
- line('Key', chalk_1.default.dim(record.key));
81
- line('Selector', chalk_1.default.yellow(record.selector));
82
- line('Tag', record.tagName);
83
- line('Text', record.text ? chalk_1.default.cyan(record.text.slice(0, 40)) : chalk_1.default.dim('—'));
84
+ process.stdout.write("\n" + chalk_1.default.dim("".repeat(w)) + "\n");
85
+ line("Key", chalk_1.default.dim(record.key));
86
+ line("Selector", chalk_1.default.yellow(record.selector));
87
+ line("Tag", record.tagName);
88
+ line("Text", record.text ? chalk_1.default.cyan(record.text.slice(0, 40)) : chalk_1.default.dim("-"));
84
89
  if (record.sourceFile) {
85
90
  const rel = path_1.default.relative(process.cwd(), record.sourceFile);
86
- line('Source', `${rel}:${record.sourceLine}`);
91
+ line("Source", `${rel}:${record.sourceLine}`);
87
92
  }
88
- line('Last Healed', record.lastHealed ? new Date(record.lastHealed).toLocaleDateString() : chalk_1.default.dim('never'));
89
- line('Status', record.isOrphaned ? chalk_1.default.red('orphaned') : record.lastHealed ? chalk_1.default.green('healed') : chalk_1.default.cyan('active'));
90
- process.stdout.write(chalk_1.default.dim('─'.repeat(w)) + '\n\n');
93
+ line("Last Healed", record.lastHealed
94
+ ? new Date(record.lastHealed).toLocaleDateString()
95
+ : chalk_1.default.dim("never"));
96
+ line("Status", record.isOrphaned
97
+ ? chalk_1.default.red("orphaned")
98
+ : record.lastHealed
99
+ ? chalk_1.default.green("healed")
100
+ : chalk_1.default.cyan("active"));
101
+ process.stdout.write(chalk_1.default.dim("─".repeat(w)) + "\n\n");
91
102
  }
92
103
  function showDiff(field, oldVal, newVal) {
93
- process.stdout.write('\n');
94
- process.stdout.write(` ${chalk_1.default.bold('Preview ' + field)}\n`);
95
- process.stdout.write(` ${''.repeat(56)}\n`);
96
- process.stdout.write(` ${chalk_1.default.red('')} ${chalk_1.default.red(formatValue(oldVal))}\n`);
97
- process.stdout.write(` ${chalk_1.default.green('+')} ${chalk_1.default.green(formatValue(newVal))}\n`);
98
- process.stdout.write('\n');
104
+ process.stdout.write("\n");
105
+ process.stdout.write(` ${chalk_1.default.bold("Preview - " + field)}\n`);
106
+ process.stdout.write(` ${"".repeat(56)}\n`);
107
+ process.stdout.write(` ${chalk_1.default.red("")} ${chalk_1.default.red(formatValue(oldVal))}\n`);
108
+ process.stdout.write(` ${chalk_1.default.green("+")} ${chalk_1.default.green(formatValue(newVal))}\n`);
109
+ process.stdout.write("\n");
99
110
  }
100
111
  // ── RefactorWizard ────────────────────────────────────────────────────────────
101
112
  class RefactorWizard {
@@ -112,7 +123,7 @@ class RefactorWizard {
112
123
  : await this.selectDna();
113
124
  // Load full snapshot once (needed for attributes/anchors fields)
114
125
  let snap = await this.svc.dnaEditor.read(record.key);
115
- // Edit loop user can edit multiple fields per session
126
+ // Edit loop - user can edit multiple fields per session
116
127
  for (;;) {
117
128
  // ── SHOW_CURRENT ──────────────────────────────────────────
118
129
  showRecordCard(record);
@@ -120,7 +131,7 @@ class RefactorWizard {
120
131
  const field = await this.selectField();
121
132
  // ── LOCATOR_DISAMBIGUATE (selector field only) ────────────
122
133
  let locatorIndex = 0;
123
- if (field === 'selector' && record.sourceFile && record.sourceLine > 0) {
134
+ if (field === "selector" && record.sourceFile && record.sourceLine > 0) {
124
135
  const locators = this.svc.sourceLink.enumerateLocatorsOnLine(record.sourceFile, record.sourceLine);
125
136
  if (locators.length > 1) {
126
137
  locatorIndex = await (0, LocatorPicker_js_1.pickLocator)(locators, record.selector);
@@ -134,18 +145,18 @@ class RefactorWizard {
134
145
  const errs = validateField(field, newValue);
135
146
  if (errs.length === 0)
136
147
  break;
137
- process.stdout.write('\n');
148
+ process.stdout.write("\n");
138
149
  for (const e of errs) {
139
- process.stdout.write(` ${chalk_1.default.red('')} ${e}\n`);
150
+ process.stdout.write(` ${chalk_1.default.red("")} ${e}\n`);
140
151
  }
141
- process.stdout.write('\n');
152
+ process.stdout.write("\n");
142
153
  }
143
154
  // ── PREVIEW_DIFF ──────────────────────────────────────────
144
155
  showDiff(field, oldValue, newValue);
145
156
  // ── CONFIRM ───────────────────────────────────────────────
146
- const apply = await this.confirm('Apply changes?');
157
+ const apply = await this.confirm("Apply changes?");
147
158
  if (!apply) {
148
- const again = await this.confirm('Edit another field?');
159
+ const again = await this.confirm("Edit another field?");
149
160
  if (!again)
150
161
  break;
151
162
  continue;
@@ -153,10 +164,10 @@ class RefactorWizard {
153
164
  // ── APPLY_SOURCE? ─────────────────────────────────────────
154
165
  let applySource = false;
155
166
  if (!this.opts.noSource &&
156
- field === 'selector' &&
167
+ field === "selector" &&
157
168
  record.sourceFile &&
158
169
  record.sourceLine > 0) {
159
- applySource = await this.confirm('Also update .spec.ts source file?');
170
+ applySource = await this.confirm("Also update .spec.ts source file?");
160
171
  }
161
172
  // ── COMMIT ────────────────────────────────────────────────
162
173
  const patch = {
@@ -168,18 +179,18 @@ class RefactorWizard {
168
179
  locatorIndex,
169
180
  };
170
181
  if (this.opts.dryRun) {
171
- process.stdout.write(`\n ${chalk_1.default.yellow('[dry-run]')} Would write: ${JSON.stringify({ field, newValue })}\n\n`);
182
+ process.stdout.write(`\n ${chalk_1.default.yellow("[dry-run]")} Would write: ${JSON.stringify({ field, newValue })}\n\n`);
172
183
  }
173
184
  else {
174
185
  const bakPath = await this.svc.dnaEditor.write(record.key, this.buildDnaPatch(field, newValue));
175
- process.stdout.write(`\n ${chalk_1.default.green('')} DNA written. Backup: ${chalk_1.default.dim(path_1.default.basename(bakPath))}\n`);
186
+ process.stdout.write(`\n ${chalk_1.default.green("")} DNA written. Backup: ${chalk_1.default.dim(path_1.default.basename(bakPath))}\n`);
176
187
  if (applySource) {
177
188
  const result = await this.svc.sourceLink.applySourceUpdate(record, patch);
178
189
  if (result.success) {
179
- process.stdout.write(` ${chalk_1.default.green('')} Source updated on line ${result.lineUpdated ?? record.sourceLine}\n`);
190
+ process.stdout.write(` ${chalk_1.default.green("")} Source updated on line ${result.lineUpdated ?? record.sourceLine}\n`);
180
191
  }
181
192
  else {
182
- process.stdout.write(` ${chalk_1.default.yellow('')} Source update: ${result.reason}\n`);
193
+ process.stdout.write(` ${chalk_1.default.yellow("")} Source update: ${result.reason}\n`);
183
194
  }
184
195
  }
185
196
  // Refresh record from index after write
@@ -189,18 +200,18 @@ class RefactorWizard {
189
200
  record = refreshed;
190
201
  }
191
202
  // ── DONE / CONTINUE? ─────────────────────────────────────
192
- const another = await this.confirm('Edit another field?');
203
+ const another = await this.confirm("Edit another field?");
193
204
  if (!another)
194
205
  break;
195
206
  }
196
- process.stdout.write('\n' + chalk_1.default.dim('Wizard complete.') + '\n\n');
207
+ process.stdout.write("\n" + chalk_1.default.dim("Wizard complete.") + "\n\n");
197
208
  }
198
209
  // ── Private helpers ───────────────────────────────────────────────────────
199
210
  resolveKey(key) {
200
211
  const record = this.svc.dnaIndex.getByKey(key);
201
212
  if (!record) {
202
213
  const err = new Error(`DNA not found: ${key}`);
203
- err.code = 'DNA_NOT_FOUND';
214
+ err.code = "DNA_NOT_FOUND";
204
215
  throw err;
205
216
  }
206
217
  return record;
@@ -208,8 +219,8 @@ class RefactorWizard {
208
219
  async selectDna() {
209
220
  const records = this.svc.dnaIndex.getIndex().records;
210
221
  if (records.length === 0) {
211
- const err = new Error('No DNA records found in snapshot directory');
212
- err.code = 'SNAPSHOT_DIR_MISSING';
222
+ const err = new Error("No DNA records found in snapshot directory");
223
+ err.code = "SNAPSHOT_DIR_MISSING";
213
224
  throw err;
214
225
  }
215
226
  const choices = records.map((r) => ({
@@ -217,8 +228,8 @@ class RefactorWizard {
217
228
  message: `${chalk_1.default.dim(r.key.slice(0, 8))} ${r.selector.padEnd(40).slice(0, 40)} ${chalk_1.default.dim(r.testTitle.slice(0, 30))}`,
218
229
  }));
219
230
  const prompt = new enquirer_js_1.AutoComplete({
220
- name: 'dna',
221
- message: 'Search DNA record (type to filter)',
231
+ name: "dna",
232
+ message: "Search DNA record (type to filter)",
222
233
  limit: 10,
223
234
  choices,
224
235
  });
@@ -227,31 +238,46 @@ class RefactorWizard {
227
238
  }
228
239
  async selectField() {
229
240
  const prompt = new enquirer_js_1.Select({
230
- name: 'field',
231
- message: 'Which field to edit?',
241
+ name: "field",
242
+ message: "Which field to edit?",
232
243
  choices: [
233
- { name: 'selector', message: `${chalk_1.default.yellow('selector')} CSS/Playwright selector` },
234
- { name: 'text', message: `${chalk_1.default.cyan('text')} Visible element text` },
235
- { name: 'tagName', message: `${chalk_1.default.dim('tagName')} HTML tag name` },
236
- { name: 'attributes', message: `${chalk_1.default.dim('attributes')} Element attributes (JSON)` },
237
- { name: 'anchors', message: `${chalk_1.default.dim('anchors')} Anchor context (JSON)` },
244
+ {
245
+ name: "selector",
246
+ message: `${chalk_1.default.yellow("selector")} CSS/Playwright selector`,
247
+ },
248
+ {
249
+ name: "text",
250
+ message: `${chalk_1.default.cyan("text")} Visible element text`,
251
+ },
252
+ {
253
+ name: "tagName",
254
+ message: `${chalk_1.default.dim("tagName")} HTML tag name`,
255
+ },
256
+ {
257
+ name: "attributes",
258
+ message: `${chalk_1.default.dim("attributes")} Element attributes (JSON)`,
259
+ },
260
+ {
261
+ name: "anchors",
262
+ message: `${chalk_1.default.dim("anchors")} Anchor context (JSON)`,
263
+ },
238
264
  ],
239
265
  });
240
266
  return (await prompt.run());
241
267
  }
242
268
  async editValue(field, current) {
243
269
  const initialStr = current === null || current === undefined
244
- ? ''
245
- : typeof current === 'object'
270
+ ? ""
271
+ : typeof current === "object"
246
272
  ? JSON.stringify(current, null, 2)
247
273
  : String(current);
248
- const hint = field === 'text'
249
- ? ' (leave blank for null)'
250
- : field === 'attributes' || field === 'anchors'
251
- ? ' (JSON)'
252
- : '';
274
+ const hint = field === "text"
275
+ ? " (leave blank for null)"
276
+ : field === "attributes" || field === "anchors"
277
+ ? " (JSON)"
278
+ : "";
253
279
  const prompt = new enquirer_js_1.Input({
254
- name: 'value',
280
+ name: "value",
255
281
  message: `New ${field}${hint}`,
256
282
  initial: initialStr,
257
283
  });
@@ -259,7 +285,7 @@ class RefactorWizard {
259
285
  return parseInput(field, raw);
260
286
  }
261
287
  async confirm(message) {
262
- const prompt = new enquirer_js_1.Confirm({ name: 'ok', message });
288
+ const prompt = new enquirer_js_1.Confirm({ name: "ok", message });
263
289
  return (await prompt.run());
264
290
  }
265
291
  buildDnaPatch(field, newValue) {
@@ -1,4 +1,4 @@
1
- import { ResolvedConfig } from './SelaConfig';
1
+ import { ResolvedConfig } from "./SelaConfig";
2
2
  export declare class ConfigLoader {
3
3
  private static resolved;
4
4
  private static branch;
@@ -10,7 +10,7 @@ export declare class ConfigLoader {
10
10
  private static logEnvBanners;
11
11
  /** Returns the detected Git branch name, or null if detection failed. */
12
12
  static getBranch(): string | null;
13
- /** Clears the singleton cache useful for testing. */
13
+ /** Clears the singleton cache - useful for testing. */
14
14
  static reset(): void;
15
15
  }
16
16
  //# sourceMappingURL=ConfigLoader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigLoader.d.ts","sourceRoot":"","sources":["../../src/config/ConfigLoader.ts"],"names":[],"mappings":"AAQA,OAAO,EAAc,cAAc,EAAiB,MAAM,cAAc,CAAC;AAoGzE,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA+B;IACtD,OAAO,CAAC,MAAM,CAAC,MAAM,CAAuB;IAE5C;;;OAGG;IACH,MAAM,CAAC,WAAW,IAAI,cAAc;IAmCpC,OAAO,CAAC,MAAM,CAAC,aAAa;IAW5B,yEAAyE;IACzE,MAAM,CAAC,SAAS,IAAI,MAAM,GAAG,IAAI;IAMjC,uDAAuD;IACvD,MAAM,CAAC,KAAK,IAAI,IAAI;CAIrB"}
1
+ {"version":3,"file":"ConfigLoader.d.ts","sourceRoot":"","sources":["../../src/config/ConfigLoader.ts"],"names":[],"mappings":"AAQA,OAAO,EAAc,cAAc,EAAiB,MAAM,cAAc,CAAC;AA4GzE,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA+B;IACtD,OAAO,CAAC,MAAM,CAAC,MAAM,CAAuB;IAE5C;;;OAGG;IACH,MAAM,CAAC,WAAW,IAAI,cAAc;IAuCpC,OAAO,CAAC,MAAM,CAAC,aAAa;IAW5B,yEAAyE;IACzE,MAAM,CAAC,SAAS,IAAI,MAAM,GAAG,IAAI;IAMjC,uDAAuD;IACvD,MAAM,CAAC,KAAK,IAAI,IAAI;CAIrB"}
@@ -48,7 +48,7 @@ const SelaConfig_1 = require("./SelaConfig");
48
48
  function findConfigFile(startDir) {
49
49
  let dir = startDir;
50
50
  while (true) {
51
- for (const name of ['sela.config.ts', 'sela.config.js']) {
51
+ for (const name of ["sela.config.ts", "sela.config.js"]) {
52
52
  const candidate = path.join(dir, name);
53
53
  if (fs.existsSync(candidate))
54
54
  return candidate;
@@ -65,19 +65,19 @@ function findConfigFile(startDir) {
65
65
  function getCurrentBranch() {
66
66
  try {
67
67
  // Fail fast if not a git repo or git is unavailable
68
- const branch = (0, child_process_1.execSync)('git rev-parse --abbrev-ref HEAD', {
69
- encoding: 'utf-8',
70
- stdio: ['pipe', 'pipe', 'pipe'],
68
+ const branch = (0, child_process_1.execSync)("git rev-parse --abbrev-ref HEAD", {
69
+ encoding: "utf-8",
70
+ stdio: ["pipe", "pipe", "pipe"],
71
71
  }).trim();
72
- if (branch === 'HEAD') {
72
+ if (branch === "HEAD") {
73
73
  // Detached HEAD (common in CI with explicit SHA checkout)
74
- console.warn('[Sela] ⚠️ Detached HEAD detected branch overrides skipped');
74
+ console.warn("[Sela] ⚠️ Detached HEAD detected - branch overrides skipped");
75
75
  return null;
76
76
  }
77
77
  return branch;
78
78
  }
79
79
  catch {
80
- console.warn('[Sela] ⚠️ Git branch detection failed branch overrides skipped');
80
+ console.warn("[Sela] ⚠️ Git branch detection failed - branch overrides skipped");
81
81
  return null;
82
82
  }
83
83
  }
@@ -91,8 +91,8 @@ function loadRawConfig(configPath) {
91
91
  // eslint-disable-next-line @typescript-eslint/no-var-requires
92
92
  const mod = require(configPath);
93
93
  const config = mod?.default ?? mod ?? {};
94
- if (typeof config !== 'object' || config === null) {
95
- console.warn(`[Sela] ⚠️ sela.config did not export an object using defaults`);
94
+ if (typeof config !== "object" || config === null) {
95
+ console.warn(`[Sela] ⚠️ sela.config did not export an object - using defaults`);
96
96
  return {};
97
97
  }
98
98
  return config;
@@ -103,7 +103,7 @@ function loadRawConfig(configPath) {
103
103
  }
104
104
  }
105
105
  // ─────────────────────────────────────────────────────────────────
106
- // DEEP MERGE (plain objects only arrays are replaced, not merged)
106
+ // DEEP MERGE (plain objects only - arrays are replaced, not merged)
107
107
  // ─────────────────────────────────────────────────────────────────
108
108
  function deepMerge(base, override) {
109
109
  const result = { ...base };
@@ -111,10 +111,10 @@ function deepMerge(base, override) {
111
111
  const baseVal = result[key];
112
112
  const overrideVal = override[key];
113
113
  if (overrideVal !== null &&
114
- typeof overrideVal === 'object' &&
114
+ typeof overrideVal === "object" &&
115
115
  !Array.isArray(overrideVal) &&
116
116
  baseVal !== null &&
117
- typeof baseVal === 'object' &&
117
+ typeof baseVal === "object" &&
118
118
  !Array.isArray(baseVal)) {
119
119
  result[key] = deepMerge(baseVal, overrideVal);
120
120
  }
@@ -162,10 +162,10 @@ class ConfigLoader {
162
162
  }
163
163
  static logEnvBanners(resolved) {
164
164
  if (resolved.dryRun) {
165
- console.log('[Sela] 🌵 DRY RUN active (SELA_DRY_RUN) disk writes & git commits suppressed.');
165
+ console.log("[Sela] 🌵 DRY RUN active (SELA_DRY_RUN) - disk writes & git commits suppressed.");
166
166
  }
167
167
  if (resolved.noCache) {
168
- console.log('[Sela] 🧊 Cache disabled (SELA_NO_CACHE).');
168
+ console.log("[Sela] 🧊 Cache disabled (SELA_NO_CACHE).");
169
169
  }
170
170
  }
171
171
  /** Returns the detected Git branch name, or null if detection failed. */
@@ -175,7 +175,7 @@ class ConfigLoader {
175
175
  ConfigLoader.getInstance();
176
176
  return ConfigLoader.branch;
177
177
  }
178
- /** Clears the singleton cache useful for testing. */
178
+ /** Clears the singleton cache - useful for testing. */
179
179
  static reset() {
180
180
  ConfigLoader.resolved = null;
181
181
  ConfigLoader.branch = null;
@@ -2,7 +2,7 @@ export declare const DryRunGuard: {
2
2
  /**
3
3
  * Returns true when `SELA_DRY_RUN` is set to a truthy value in the current
4
4
  * process environment. Throws via `parseEnvBoolean` when the value is not
5
- * one of the accepted tokens fail-fast keeps misconfigured CI loud.
5
+ * one of the accepted tokens - fail-fast keeps misconfigured CI loud.
6
6
  */
7
7
  active(env?: NodeJS.ProcessEnv): boolean;
8
8
  /**