sela-core 1.0.8 → 1.0.9
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 +27 -17
- package/dist/cli/commands/init.js +1 -1
- package/dist/cli/commands/merge.d.ts +13 -0
- package/dist/cli/commands/merge.d.ts.map +1 -0
- package/dist/cli/commands/merge.js +119 -0
- package/dist/cli/index.js +4 -1
- package/dist/config/SelaConfig.d.ts +1 -1
- package/dist/config/SelaConfig.d.ts.map +1 -1
- package/dist/config/SelaConfig.js +1 -1
- package/dist/engine/SelaEngine.d.ts.map +1 -1
- package/dist/engine/SelaEngine.js +54 -2
- package/dist/errors/SelaError.d.ts +8 -0
- package/dist/errors/SelaError.d.ts.map +1 -1
- package/dist/errors/SelaError.js +8 -0
- package/dist/fixtures/expectProxy.d.ts +1 -1
- package/dist/fixtures/expectProxy.js +6 -6
- package/dist/fixtures/index.d.ts +18 -2
- package/dist/fixtures/index.d.ts.map +1 -1
- package/dist/fixtures/index.js +34 -14
- package/dist/fixtures/moduleExpect.js +7 -7
- package/dist/fixtures/proxyTag.js +1 -1
- package/dist/services/ASTSourceUpdater.d.ts +45 -0
- package/dist/services/ASTSourceUpdater.d.ts.map +1 -1
- package/dist/services/ASTSourceUpdater.js +201 -47
- package/dist/services/AnchorResolver.d.ts +157 -0
- package/dist/services/AnchorResolver.d.ts.map +1 -0
- package/dist/services/AnchorResolver.js +289 -0
- package/dist/services/DecisionEngine.d.ts +51 -0
- package/dist/services/DecisionEngine.d.ts.map +1 -0
- package/dist/services/DecisionEngine.js +260 -0
- package/dist/services/HealReportService.d.ts +31 -55
- package/dist/services/HealReportService.d.ts.map +1 -1
- package/dist/services/HealReportService.js +863 -1243
- package/dist/services/HealingAdvisory.d.ts +9 -1
- package/dist/services/HealingAdvisory.d.ts.map +1 -1
- package/dist/services/HealingAdvisory.js +8 -0
- package/dist/services/InitializerUpdater.d.ts.map +1 -1
- package/dist/services/InitializerUpdater.js +10 -0
- package/dist/services/InteractiveReview.d.ts.map +1 -1
- package/dist/services/InteractiveReview.js +4 -1
- package/dist/services/MutationApplier.d.ts +55 -0
- package/dist/services/MutationApplier.d.ts.map +1 -0
- package/dist/services/MutationApplier.js +322 -0
- package/dist/services/PendingPromptLedger.d.ts +7 -0
- package/dist/services/PendingPromptLedger.d.ts.map +1 -1
- package/dist/services/PendingPromptLedger.js +25 -0
- package/dist/services/ReportGenerator.d.ts +116 -30
- package/dist/services/ReportGenerator.d.ts.map +1 -1
- package/dist/services/ReportGenerator.js +150 -63
- package/dist/services/ReportMergeService.d.ts +95 -0
- package/dist/services/ReportMergeService.d.ts.map +1 -0
- package/dist/services/ReportMergeService.js +0 -0
- package/dist/services/SafetyGuard.d.ts +1 -1
- package/dist/services/SafetyGuard.d.ts.map +1 -1
- package/dist/services/SelectorSanitizer.d.ts +52 -0
- package/dist/services/SelectorSanitizer.d.ts.map +1 -0
- package/dist/services/SelectorSanitizer.js +318 -0
- package/dist/services/SnapshotService.js +1 -1
- package/dist/services/SourceUpdater.d.ts.map +1 -1
- package/dist/services/SourceUpdater.js +17 -0
- package/dist/services/TraceBackEngine.d.ts +67 -0
- package/dist/services/TraceBackEngine.d.ts.map +1 -0
- package/dist/services/TraceBackEngine.js +672 -0
- package/dist/utils/DOMUtils.d.ts +18 -2
- package/dist/utils/DOMUtils.d.ts.map +1 -1
- package/dist/utils/DOMUtils.js +335 -49
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# Sela
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
3
|
## Getting started
|
|
6
4
|
|
|
7
5
|
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
|
@@ -10,39 +8,39 @@ Already a pro? Just edit this README.md and make it your own. Want to make it ea
|
|
|
10
8
|
|
|
11
9
|
## Add your files
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
- [Create](https://docs.gitlab.com/user/project/repository/web_editor/#create-a-file) or [upload](https://docs.gitlab.com/user/project/repository/web_editor/#upload-a-file) files
|
|
12
|
+
- [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command:
|
|
15
13
|
|
|
16
14
|
```
|
|
17
15
|
cd existing_repo
|
|
18
|
-
git remote add origin https://gitlab.com/
|
|
16
|
+
git remote add origin https://gitlab.com/sela/Sela.git
|
|
19
17
|
git branch -M main
|
|
20
18
|
git push -uf origin main
|
|
21
19
|
```
|
|
22
20
|
|
|
23
21
|
## Integrate with your tools
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
- [Set up project integrations](https://gitlab.com/sela/Sela/-/settings/integrations)
|
|
26
24
|
|
|
27
25
|
## Collaborate with your team
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
- [Invite team members and collaborators](https://docs.gitlab.com/user/project/members/)
|
|
28
|
+
- [Create a new merge request](https://docs.gitlab.com/user/project/merge_requests/creating_merge_requests/)
|
|
29
|
+
- [Automatically close issues from merge requests](https://docs.gitlab.com/user/project/issues/managing_issues/#closing-issues-automatically)
|
|
30
|
+
- [Enable merge request approvals](https://docs.gitlab.com/user/project/merge_requests/approvals/)
|
|
31
|
+
- [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)
|
|
34
32
|
|
|
35
33
|
## Test and Deploy
|
|
36
34
|
|
|
37
35
|
Use the built-in continuous integration in GitLab.
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
- [Get started with GitLab CI/CD](https://docs.gitlab.com/ci/quick_start/)
|
|
38
|
+
- [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/user/application_security/sast/)
|
|
39
|
+
- [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/topics/autodevops/requirements/)
|
|
40
|
+
- [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/user/clusters/agent/)
|
|
41
|
+
- [Set up protected environments](https://docs.gitlab.com/ci/environments/protected_environments/)
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
---
|
|
46
44
|
|
|
47
45
|
# Editing this README
|
|
48
46
|
|
|
@@ -53,30 +51,39 @@ When you're ready to make this README your own, just edit this file and use the
|
|
|
53
51
|
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
|
54
52
|
|
|
55
53
|
## Name
|
|
54
|
+
|
|
56
55
|
Choose a self-explaining name for your project.
|
|
57
56
|
|
|
58
57
|
## Description
|
|
58
|
+
|
|
59
59
|
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
|
60
60
|
|
|
61
61
|
## Badges
|
|
62
|
+
|
|
62
63
|
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
|
63
64
|
|
|
64
65
|
## Visuals
|
|
66
|
+
|
|
65
67
|
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
|
66
68
|
|
|
67
69
|
## Installation
|
|
70
|
+
|
|
68
71
|
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
|
69
72
|
|
|
70
73
|
## Usage
|
|
74
|
+
|
|
71
75
|
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
|
72
76
|
|
|
73
77
|
## Support
|
|
78
|
+
|
|
74
79
|
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
|
75
80
|
|
|
76
81
|
## Roadmap
|
|
82
|
+
|
|
77
83
|
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
|
78
84
|
|
|
79
85
|
## Contributing
|
|
86
|
+
|
|
80
87
|
State if you are open to contributions and what your requirements are for accepting them.
|
|
81
88
|
|
|
82
89
|
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
|
@@ -84,10 +91,13 @@ For people who want to make changes to your project, it's helpful to have some d
|
|
|
84
91
|
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
|
85
92
|
|
|
86
93
|
## Authors and acknowledgment
|
|
94
|
+
|
|
87
95
|
Show your appreciation to those who have contributed to the project.
|
|
88
96
|
|
|
89
97
|
## License
|
|
98
|
+
|
|
90
99
|
For open source projects, say how it is licensed.
|
|
91
100
|
|
|
92
101
|
## Project status
|
|
102
|
+
|
|
93
103
|
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* `sela merge [files...]`
|
|
4
|
+
*
|
|
5
|
+
* Aggregates per-shard `sela-report.json` files (uploaded as CI artifacts)
|
|
6
|
+
* into ONE coherent `.sela-history.json` + `sela-report.html` + `sela-report.json`.
|
|
7
|
+
*
|
|
8
|
+
* Resolution order for the shard files:
|
|
9
|
+
* 1. Explicit positional paths (shells on Linux runners expand globs here).
|
|
10
|
+
* 2. Otherwise scan `--shard-dir` for filenames matching `--shard-glob`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function registerMerge(program: Command): void;
|
|
13
|
+
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/merge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBzC;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8FpD"}
|
|
@@ -0,0 +1,119 @@
|
|
|
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.registerMerge = registerMerge;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const ReportMergeService_js_1 = require("../../services/ReportMergeService.js");
|
|
39
|
+
const SelaError_js_1 = require("../../errors/SelaError.js");
|
|
40
|
+
/**
|
|
41
|
+
* `sela merge [files...]`
|
|
42
|
+
*
|
|
43
|
+
* Aggregates per-shard `sela-report.json` files (uploaded as CI artifacts)
|
|
44
|
+
* into ONE coherent `.sela-history.json` + `sela-report.html` + `sela-report.json`.
|
|
45
|
+
*
|
|
46
|
+
* Resolution order for the shard files:
|
|
47
|
+
* 1. Explicit positional paths (shells on Linux runners expand globs here).
|
|
48
|
+
* 2. Otherwise scan `--shard-dir` for filenames matching `--shard-glob`.
|
|
49
|
+
*/
|
|
50
|
+
function registerMerge(program) {
|
|
51
|
+
program
|
|
52
|
+
.command("merge")
|
|
53
|
+
.argument("[files...]", "Explicit shard report JSON files (sela-report.json shape). " +
|
|
54
|
+
"When omitted, --shard-dir is scanned with --shard-glob.")
|
|
55
|
+
.description("Merge sharded Sela reports into a single history + HTML report (CI fan-in)")
|
|
56
|
+
.option("--dir <path>", "Output dir for the merged report + rolling history (and where the prior .sela-history.json lives)", process.cwd())
|
|
57
|
+
.option("--shard-dir <path>", "Directory to scan for shard reports when no explicit files are given", process.cwd())
|
|
58
|
+
.option("--shard-glob <pattern>", "Filename glob (single * wildcard) used when scanning --shard-dir", "sela-shard-*.json")
|
|
59
|
+
.option("--run-id <id>", "Single dedup id for the merged history row (defaults to GITHUB_RUN_ID / CI_PIPELINE_ID)")
|
|
60
|
+
.option("--expected-shards <n>", "Number of shards launched; a smaller readable count flags a partial merge")
|
|
61
|
+
.action(async (files, opts) => {
|
|
62
|
+
const targetDir = path.resolve(opts.dir ?? process.cwd());
|
|
63
|
+
const shardDir = path.resolve(opts.shardDir ?? process.cwd());
|
|
64
|
+
const shardFiles = files && files.length > 0
|
|
65
|
+
? files.map((f) => path.resolve(f))
|
|
66
|
+
: ReportMergeService_js_1.ReportMergeService.discoverShardFiles(shardDir, opts.shardGlob ?? "sela-shard-*.json");
|
|
67
|
+
if (shardFiles.length === 0) {
|
|
68
|
+
process.stderr.write(`[sela] No shard reports found ` +
|
|
69
|
+
`(looked in ${shardDir} for "${opts.shardGlob ?? "sela-shard-*.json"}").\n` +
|
|
70
|
+
` A merged report with a healed:0 history row will still be written ` +
|
|
71
|
+
`to keep the trend cadence intact.\n`);
|
|
72
|
+
}
|
|
73
|
+
const expectedShards = parseExpectedShards(opts.expectedShards);
|
|
74
|
+
let result;
|
|
75
|
+
try {
|
|
76
|
+
result = ReportMergeService_js_1.ReportMergeService.merge({
|
|
77
|
+
shardFiles,
|
|
78
|
+
targetDir,
|
|
79
|
+
runId: opts.runId,
|
|
80
|
+
expectedShards,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
// A corrupt prior history (HISTORY_CORRUPT) is the one hard-fail: we
|
|
85
|
+
// must not silently overwrite a durable rolling window.
|
|
86
|
+
if ((0, SelaError_js_1.isSelaError)(err)) {
|
|
87
|
+
process.stderr.write(`[sela] merge aborted: ${err.message}\n`);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
91
|
+
process.stderr.write(`[sela] merge failed: ${msg}\n`);
|
|
92
|
+
}
|
|
93
|
+
process.exit(1);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
process.stdout.write(`[sela] Merged report written: ${result.htmlPath}\n` +
|
|
97
|
+
` shards: ${result.shardsRead}` +
|
|
98
|
+
(result.shardsExpected != null ? `/${result.shardsExpected}` : "") +
|
|
99
|
+
` events: ${result.uniqueEvents}` +
|
|
100
|
+
(result.duplicatesDropped > 0
|
|
101
|
+
? ` (${result.duplicatesDropped} dup dropped)`
|
|
102
|
+
: "") +
|
|
103
|
+
` history: ${result.data.historical_runs.length} run(s)\n`);
|
|
104
|
+
// Partial merges are surfaced but DO NOT fail the job (aggregate-and-flag).
|
|
105
|
+
if (result.partial) {
|
|
106
|
+
process.exitCode = 0;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Parse `--expected-shards`. Ignores non-positive / non-numeric input so a
|
|
112
|
+
* bad flag degrades to "no expectation" rather than crashing the fan-in.
|
|
113
|
+
*/
|
|
114
|
+
function parseExpectedShards(raw) {
|
|
115
|
+
if (raw == null)
|
|
116
|
+
return undefined;
|
|
117
|
+
const n = Number.parseInt(raw, 10);
|
|
118
|
+
return Number.isFinite(n) && n > 0 ? n : undefined;
|
|
119
|
+
}
|
package/dist/cli/index.js
CHANGED
|
@@ -52,13 +52,14 @@ const refactor_js_1 = require("./commands/refactor.js");
|
|
|
52
52
|
const bulk_js_1 = require("./commands/bulk.js");
|
|
53
53
|
const sync_js_1 = require("./commands/sync.js");
|
|
54
54
|
const showReport_js_1 = require("./commands/showReport.js");
|
|
55
|
+
const merge_js_1 = require("./commands/merge.js");
|
|
55
56
|
(0, ErrorHandler_js_1.registerGlobalHandlers)();
|
|
56
57
|
// Diagnostic console.log from services (ConfigLoader etc.) → stderr so stdout stays pipe-clean
|
|
57
58
|
console.log = (...args) => process.stderr.write(args.map(String).join(" ") + "\n");
|
|
58
59
|
const program = new commander_1.Command();
|
|
59
60
|
program
|
|
60
61
|
.name("sela")
|
|
61
|
-
.description("Sela CLI - proactive DNA management for
|
|
62
|
+
.description("Sela CLI - proactive DNA management for Sela")
|
|
62
63
|
.version("1.0.3")
|
|
63
64
|
.exitOverride(ErrorHandler_js_1.handleError)
|
|
64
65
|
.configureOutput({ outputError: () => { } });
|
|
@@ -70,6 +71,8 @@ program
|
|
|
70
71
|
(0, list_js_1.registerList)(program);
|
|
71
72
|
// ── sela show-report - open Sela Insights HTML ───────────────────────────────
|
|
72
73
|
(0, showReport_js_1.registerShowReport)(program);
|
|
74
|
+
// ── sela merge - CI fan-in: aggregate sharded reports into one ────────────────
|
|
75
|
+
(0, merge_js_1.registerMerge)(program);
|
|
73
76
|
// ── sela dna <subcommand> ─────────────────────────────────────────────────────
|
|
74
77
|
const dna = new commander_1.Command("dna")
|
|
75
78
|
.description("DNA management commands")
|
|
@@ -56,7 +56,7 @@ export interface SelaConfig {
|
|
|
56
56
|
autoCommit?: boolean;
|
|
57
57
|
/** Git-flow automation (PR/draft PR/direct commit/read-only). See SelaPRAutomationConfig. */
|
|
58
58
|
prAutomation?: SelaPRAutomationConfig;
|
|
59
|
-
/** Directory for DNA snapshots. Default: '
|
|
59
|
+
/** Directory for DNA snapshots. Default: 'sela-snapshots'. */
|
|
60
60
|
dnaStoragePath?: string;
|
|
61
61
|
/**
|
|
62
62
|
* Per-branch config overrides. Keys are exact branch names.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelaConfig.d.ts","sourceRoot":"","sources":["../../src/config/SelaConfig.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,IAAI,GAAG,SAAS,GAAG,UAAU,CAAC;AACxE,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,aAAa,GAAG,WAAW,CAAC;AAE/D,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,UAAU,CAAC;IAEtB,qEAAqE;IACrE,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE7B,oFAAoF;IAC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M,EAAE,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,kBAAkB,CAAC;IAC/B,cAAc,EAAE,SAAS,GAAG,aAAa,GAAG,QAAQ,CAAC;IACrD,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,oBAAoB,CAAC;IACnC,gBAAgB,EAAE;QAChB,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,kBAAkB,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;IACF;;;;;;OAMG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AA6CD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,kBAAkB,CAgBxE;AA8CD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,OAAO,CAST;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,UAAU,EAClB,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,cAAc,CAgChB"}
|
|
@@ -106,7 +106,7 @@ function resolveConfig(config, env = process.env) {
|
|
|
106
106
|
thresholds: resolveThresholds(config),
|
|
107
107
|
updateStrategy,
|
|
108
108
|
autoCommit,
|
|
109
|
-
dnaStoragePath: config.dnaStoragePath ?? "
|
|
109
|
+
dnaStoragePath: config.dnaStoragePath ?? "sela-snapshots",
|
|
110
110
|
prAutomation,
|
|
111
111
|
agenticDiscovery: {
|
|
112
112
|
enabled: config.agenticDiscovery?.enabled ?? false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelaEngine.d.ts","sourceRoot":"","sources":["../../src/engine/SelaEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAaxC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E,MAAM;CAqBnB;AAED,OAAO,EAAE,CAAC"}
|
|
@@ -413,7 +413,59 @@ If the text has NOT changed, omit the "contentChange" field entirely.`;
|
|
|
413
413
|
`(raw ${fmtPctEngine(breakdown.rawConfidence)}, ${parts.join(", ")})`);
|
|
414
414
|
}
|
|
415
415
|
console.log(`[Sela] 🚀 Rebuilt Full Runtime Selector (Clean): ${newFullSelector}`);
|
|
416
|
-
|
|
416
|
+
// ── PRIMARY: composeHeal trace-back pipeline (Stages 1-4) ──────────
|
|
417
|
+
// Trace the failing call-site to its source declaration and apply a
|
|
418
|
+
// write-disciplined Method-Shift / in-place mutation through the
|
|
419
|
+
// type-safety gate. Restricted to plain in-place writes (commentOnly /
|
|
420
|
+
// branch / autoCommit / dry-run keep the legacy git-aware path).
|
|
421
|
+
// Falls back to the legacy regex/semantic engine on ABORT / PROMPT.
|
|
422
|
+
let updateResult;
|
|
423
|
+
const plainInPlace = (!this.config.updateStrategy ||
|
|
424
|
+
this.config.updateStrategy === "inPlace") &&
|
|
425
|
+
!this.config.autoCommit;
|
|
426
|
+
const resolvedForCompose = SourceUpdater_1.SourceUpdater.resolveFilePath(filePath);
|
|
427
|
+
if (plainInPlace && !DryRunGuard_1.DryRunGuard.active() && resolvedForCompose) {
|
|
428
|
+
try {
|
|
429
|
+
WorkspaceSnapshotService_1.sharedWorkspaceSnapshot.preWrite(resolvedForCompose);
|
|
430
|
+
const composed = ASTSourceUpdater_1.ASTSourceUpdater.composeHeal({
|
|
431
|
+
filePath: resolvedForCompose,
|
|
432
|
+
line,
|
|
433
|
+
newSelector: newFullSelector,
|
|
434
|
+
apply: true,
|
|
435
|
+
applyOptions: { respectDryRun: true },
|
|
436
|
+
});
|
|
437
|
+
const strat = composed.decision?.strategy;
|
|
438
|
+
if (composed.kind === "decision" &&
|
|
439
|
+
composed.outcome?.status === "applied" &&
|
|
440
|
+
(strat === "MUTATE_IN_PLACE" || strat === "FORK_AT_TEST")) {
|
|
441
|
+
WorkspaceSnapshotService_1.sharedWorkspaceSnapshot.postWrite(resolvedForCompose);
|
|
442
|
+
const wl = composed.writtenLine ?? line;
|
|
443
|
+
updateResult = {
|
|
444
|
+
success: true,
|
|
445
|
+
reason: `composeHeal[${strat}]: ${composed.decision.reason}`,
|
|
446
|
+
lineUpdated: wl - 1,
|
|
447
|
+
healedLocatorString: newFullSelector,
|
|
448
|
+
definitionSite: { file: resolvedForCompose, line: wl - 1 },
|
|
449
|
+
blastRadius: composed.decision.blastRadius,
|
|
450
|
+
};
|
|
451
|
+
console.log(`[Sela] 🧠 composeHeal primary path applied (${strat})`);
|
|
452
|
+
}
|
|
453
|
+
else {
|
|
454
|
+
const why = composed.kind === "abort"
|
|
455
|
+
? `abort:${composed.trace.code ?? composed.trace.status}`
|
|
456
|
+
: `${strat ?? "no-decision"}/${composed.outcome?.status ?? "not-applied"}`;
|
|
457
|
+
console.log(`[Sela] ↩️ composeHeal declined (${why}) - falling back to legacy heal`);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
catch (e) {
|
|
461
|
+
console.warn(`[Sela] composeHeal primary failed (${e?.message}) - falling back to legacy heal`);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
// ── FALLBACK: legacy regex/semantic heal (also handles dry-run /
|
|
465
|
+
// commentOnly / branch / autoCommit / cross-file). ──────────────
|
|
466
|
+
if (!updateResult) {
|
|
467
|
+
updateResult = SourceUpdater_1.SourceUpdater.update({ filePath, line }, elementSelectorOnly, newFullSelector, neighborhoodDom, undefined, fullSelector, aiFix.segments, aiFix.contentChange, aiFix.chainSegments, aiFix.originalChainHint, this.config.updateStrategy, this.config.autoCommit);
|
|
468
|
+
}
|
|
417
469
|
// Resolve the line that was actually mutated. Order of precedence:
|
|
418
470
|
// 1. updateResult.lineUpdated (the strategy's literal write location)
|
|
419
471
|
// 2. updateResult.definitionSite.line (semantic JumpToDef target,
|
|
@@ -947,7 +999,7 @@ If the text has NOT changed, omit the "contentChange" field entirely.`;
|
|
|
947
999
|
const ignoreList = [
|
|
948
1000
|
"node_modules",
|
|
949
1001
|
".git",
|
|
950
|
-
"
|
|
1002
|
+
"sela-snapshots",
|
|
951
1003
|
"dist",
|
|
952
1004
|
"test-results",
|
|
953
1005
|
"tests/reset-demo.ts",
|
|
@@ -119,6 +119,14 @@ export declare const REPORT_CODES: {
|
|
|
119
119
|
readonly INVALID_FIELD_TYPE: "REP_INVALID_FIELD_TYPE";
|
|
120
120
|
/** Disk write failed during flushToDisk(). */
|
|
121
121
|
readonly FLUSH_FAILED: "REP_FLUSH_FAILED";
|
|
122
|
+
/**
|
|
123
|
+
* A prior `.sela-history.json` existed on disk but could not be parsed as
|
|
124
|
+
* a JSON array. The merge path refuses to silently overwrite it with a
|
|
125
|
+
* fresh window (which would destroy the rolling history), so it aborts.
|
|
126
|
+
*/
|
|
127
|
+
readonly HISTORY_CORRUPT: "REP_HISTORY_CORRUPT";
|
|
128
|
+
/** A shard report file existed but was not valid JSON / had no events array. */
|
|
129
|
+
readonly SHARD_UNREADABLE: "REP_SHARD_UNREADABLE";
|
|
122
130
|
};
|
|
123
131
|
export type ReportCode = (typeof REPORT_CODES)[keyof typeof REPORT_CODES];
|
|
124
132
|
export declare const CHAIN_VALIDATOR_CODES: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelaError.d.ts","sourceRoot":"","sources":["../../src/errors/SelaError.ts"],"names":[],"mappings":"AAkBA,MAAM,MAAM,aAAa,GACrB,aAAa,GACb,eAAe,GACf,YAAY,GACZ,OAAO,GACP,YAAY,GACZ,UAAU,GACV,gBAAgB,GAChB,QAAQ,GACR,QAAQ,CAAC;AAMb,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ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AO,iBAAiB,CAAC,CAAC;AAE7D,eAAO,MAAM,iBAAiB;;;;;;;IAO5B;;;;OAIG;;CAEK,CAAC;AACX,MAAM,MAAM,cAAc,GACxB,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAE7D,eAAO,MAAM,WAAW;;;;CAId,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAEvE,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAEhF,eAAO,MAAM,YAAY;IACvB,2EAA2E;;IAE3E,wDAAwD;;IAExD,gEAAgE;;IAEhE,gDAAgD;;IAEhD,8CAA8C;;IAE9C;;;;OAIG;;IAEH,gFAAgF;;CAExE,CAAC;AACX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE1E,eAAO,MAAM,qBAAqB;;;;;;CAMxB,CAAC;AACX,MAAM,MAAM,kBAAkB,GAC5B,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC"}
|
package/dist/errors/SelaError.js
CHANGED
|
@@ -144,6 +144,14 @@ exports.REPORT_CODES = {
|
|
|
144
144
|
INVALID_FIELD_TYPE: "REP_INVALID_FIELD_TYPE",
|
|
145
145
|
/** Disk write failed during flushToDisk(). */
|
|
146
146
|
FLUSH_FAILED: "REP_FLUSH_FAILED",
|
|
147
|
+
/**
|
|
148
|
+
* A prior `.sela-history.json` existed on disk but could not be parsed as
|
|
149
|
+
* a JSON array. The merge path refuses to silently overwrite it with a
|
|
150
|
+
* fresh window (which would destroy the rolling history), so it aborts.
|
|
151
|
+
*/
|
|
152
|
+
HISTORY_CORRUPT: "REP_HISTORY_CORRUPT",
|
|
153
|
+
/** A shard report file existed but was not valid JSON / had no events array. */
|
|
154
|
+
SHARD_UNREADABLE: "REP_SHARD_UNREADABLE",
|
|
147
155
|
};
|
|
148
156
|
exports.CHAIN_VALIDATOR_CODES = {
|
|
149
157
|
TYPE_FLOW: "CV_TYPE_FLOW",
|
|
@@ -3,7 +3,7 @@ import { SelaEngine } from "../engine/SelaEngine";
|
|
|
3
3
|
/**
|
|
4
4
|
* createHealingExpect - drop-in replacement for Playwright's expect().
|
|
5
5
|
*
|
|
6
|
-
* @param resolveProxy Optional callback that unwraps a
|
|
6
|
+
* @param resolveProxy Optional callback that unwraps a Sela proxy
|
|
7
7
|
* to its current live Locator. Supplied by
|
|
8
8
|
* fixtures/index.ts which owns proxyToActiveLocator.
|
|
9
9
|
*/
|
|
@@ -18,7 +18,7 @@ function isElementNotFoundError(err) {
|
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Returns true only for genuine Playwright Locator instances -
|
|
21
|
-
* not FrameLocator proxies or
|
|
21
|
+
* not FrameLocator proxies or Sela proxy objects.
|
|
22
22
|
*
|
|
23
23
|
* A real Locator has _frame internally.
|
|
24
24
|
* A FrameLocator has _frameSelector instead.
|
|
@@ -30,10 +30,10 @@ function isRealLocator(value) {
|
|
|
30
30
|
return false;
|
|
31
31
|
if (typeof value !== "object")
|
|
32
32
|
return false;
|
|
33
|
-
//
|
|
33
|
+
// Sela locator proxies expose `_selaSelector`. The proxy forwards
|
|
34
34
|
// `_frame` via Reflect.get so `hasFrame` would lie - explicitly reject them
|
|
35
35
|
// here. Callers should unwrap via `resolveProxy` first.
|
|
36
|
-
if (value.
|
|
36
|
+
if (value._selaSelector !== undefined)
|
|
37
37
|
return false;
|
|
38
38
|
const hasFrame = value._frame !== undefined ||
|
|
39
39
|
value._impl?._frame !== undefined;
|
|
@@ -69,7 +69,7 @@ function extractSelectorFromLocator(locator) {
|
|
|
69
69
|
* This function correctly chains frameLocator() calls for each frame
|
|
70
70
|
* segment, then calls .locator() for the final element segment.
|
|
71
71
|
*
|
|
72
|
-
* Convention used by
|
|
72
|
+
* Convention used by SelaEngine segments:
|
|
73
73
|
* - Frame segments look like CSS selectors for iframes (#id, .class)
|
|
74
74
|
* but produce a FrameLocator, not a Locator.
|
|
75
75
|
* - The last segment is always the element selector.
|
|
@@ -184,7 +184,7 @@ const WRAPPED_MATCHERS = [
|
|
|
184
184
|
/**
|
|
185
185
|
* createHealingExpect - drop-in replacement for Playwright's expect().
|
|
186
186
|
*
|
|
187
|
-
* @param resolveProxy Optional callback that unwraps a
|
|
187
|
+
* @param resolveProxy Optional callback that unwraps a Sela proxy
|
|
188
188
|
* to its current live Locator. Supplied by
|
|
189
189
|
* fixtures/index.ts which owns proxyToActiveLocator.
|
|
190
190
|
*/
|
|
@@ -204,7 +204,7 @@ resolveProxy) {
|
|
|
204
204
|
return initialLine;
|
|
205
205
|
};
|
|
206
206
|
const actualLine = getCallerLine(); // כאן אנחנו מקבלים את השורה הנכונה!
|
|
207
|
-
// Step 1 - unwrap
|
|
207
|
+
// Step 1 - unwrap Sela proxy to real active Locator
|
|
208
208
|
let resolved = locatorOrValue;
|
|
209
209
|
if (resolveProxy) {
|
|
210
210
|
const unwrapped = resolveProxy(locatorOrValue);
|
package/dist/fixtures/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Locator, Page } from "@playwright/test";
|
|
2
2
|
import { createHealingExpect } from "./expectProxy";
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function resolveSelaProxy(value: unknown): Locator | null;
|
|
4
4
|
export declare function createFrameLocatorProxy(rawFrameLocator: any, frameSelector: string, rawPage: Page, testTitle: string, actionCounter: {
|
|
5
5
|
value: number;
|
|
6
6
|
}, parentChain: string): any;
|
|
@@ -9,6 +9,22 @@ export declare function createLocatorProxy(rawLocator: Locator, selector: string
|
|
|
9
9
|
}, elementSelectorOnly?: string): any;
|
|
10
10
|
export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & {
|
|
11
11
|
expect: ReturnType<typeof createHealingExpect>;
|
|
12
|
-
}, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions
|
|
12
|
+
}, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & {
|
|
13
|
+
/**
|
|
14
|
+
* Worker-scoped lifecycle anchor. Its teardown runs EXACTLY ONCE per
|
|
15
|
+
* worker process - after every test in that worker has finished - which
|
|
16
|
+
* is the only correct place to flush the suite-wide healing report.
|
|
17
|
+
*
|
|
18
|
+
* Why a worker fixture and not the reporter's onEnd():
|
|
19
|
+
* Playwright runs tests in worker processes; the reporter lives in the
|
|
20
|
+
* main process. The `sharedHealReport` buffer, `HealingRegistry`, and
|
|
21
|
+
* `sharedWorkspaceSnapshot` singletons that accumulate heal events all
|
|
22
|
+
* live in the WORKER. The main-process reporter cannot see them, so the
|
|
23
|
+
* flush MUST happen worker-side. The reporter's cross-process
|
|
24
|
+
* PendingPromptLedger (written here, drained in onEnd) is what carries
|
|
25
|
+
* the DX-review summary back to the main process.
|
|
26
|
+
*/
|
|
27
|
+
_selaWorkerLifecycle: void;
|
|
28
|
+
}>;
|
|
13
29
|
export { createHealingExpect } from "./expectProxy";
|
|
14
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fixtures/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAI/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAYpD,wBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fixtures/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAI/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAYpD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAI/D;AA2jBD,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,GAAG,EACpB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,IAAI,EACb,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAChC,WAAW,EAAE,MAAM,GAClB,GAAG,CAuCL;AAaD,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,OAAO,EACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,IAAI,EACb,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAChC,mBAAmB,CAAC,EAAE,MAAM,GAC3B,GAAG,CAkPL;AAQD,eAAO,MAAM,IAAI;YAEL,UAAU,CAAC,OAAO,mBAAmB,CAAC;;IAG9C;;;;;;;;;;;;;OAaG;0BACmB,IAAI;EAwH5B,CAAC;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC"}
|