@delegance/claude-autopilot 7.6.0 → 7.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +101 -0
- package/README.md +19 -0
- package/bin/_launcher.js +310 -6
- package/dist/src/cli/dashboard/missing-package.d.ts +48 -0
- package/dist/src/cli/dashboard/missing-package.js +85 -0
- package/dist/src/cli/dashboard/upload.d.ts +1 -1
- package/dist/src/cli/dashboard/upload.js +20 -1
- package/dist/src/cli/help-text.d.ts +1 -1
- package/dist/src/cli/help-text.js +12 -2
- package/dist/src/cli/index.js +33 -2
- package/dist/src/cli/scaffold/rust.d.ts +38 -0
- package/dist/src/cli/scaffold/rust.js +281 -0
- package/dist/src/cli/scaffold/types.d.ts +7 -4
- package/dist/src/cli/scaffold.d.ts +1 -1
- package/dist/src/cli/scaffold.js +48 -17
- package/dist/src/cli/tsx-resolver.d.ts +42 -0
- package/dist/src/cli/tsx-resolver.js +376 -0
- package/package.json +4 -7
- package/scripts/autoregress.ts +0 -402
- package/scripts/snapshots/impact-selector.ts +0 -60
- package/scripts/snapshots/import-scanner.ts +0 -44
- package/scripts/snapshots/serializer.ts +0 -24
- package/tests/snapshots/baselines/.gitkeep +0 -0
- package/tests/snapshots/baselines/src-formatters-sarif.json +0 -210
- package/tests/snapshots/baselines/src-snapshots-impact-selector.json +0 -32
- package/tests/snapshots/baselines/src-snapshots-import-scanner.json +0 -21
- package/tests/snapshots/baselines/src-snapshots-serializer.json +0 -39
- package/tests/snapshots/import-map.json +0 -138
- package/tests/snapshots/index.json +0 -14
- package/tests/snapshots/src-formatters-sarif.snap.ts +0 -132
- package/tests/snapshots/src-snapshots-impact-selector.snap.ts +0 -95
- package/tests/snapshots/src-snapshots-import-scanner.snap.ts +0 -126
- package/tests/snapshots/src-snapshots-serializer.snap.ts +0 -64
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"normalizeSarifUri handles relative absolute and parent escaping paths": {
|
|
3
|
-
"rel": "src/index.ts",
|
|
4
|
-
"absInside": "lib/file.ts",
|
|
5
|
-
"absOutside": "/other/place/file.ts",
|
|
6
|
-
"dotted": "scripts/run.ts",
|
|
7
|
-
"windows": "folder/nested/file.ts"
|
|
8
|
-
},
|
|
9
|
-
"toSarif emits schema tool metadata rules and mapped severities": {
|
|
10
|
-
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
|
|
11
|
-
"version": "2.1.0",
|
|
12
|
-
"runs": [
|
|
13
|
-
{
|
|
14
|
-
"tool": {
|
|
15
|
-
"driver": {
|
|
16
|
-
"name": "guardrail",
|
|
17
|
-
"version": "9.9.9",
|
|
18
|
-
"informationUri": "https://github.com/axledbetter/guardrail",
|
|
19
|
-
"rules": [
|
|
20
|
-
{
|
|
21
|
-
"id": "no-secrets",
|
|
22
|
-
"name": "no-secrets",
|
|
23
|
-
"shortDescription": {
|
|
24
|
-
"text": "no-secrets"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"id": "style-warning",
|
|
29
|
-
"name": "style-warning",
|
|
30
|
-
"shortDescription": {
|
|
31
|
-
"text": "style-warning"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"id": "info-note",
|
|
36
|
-
"name": "info-note",
|
|
37
|
-
"shortDescription": {
|
|
38
|
-
"text": "info-note"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"results": [
|
|
45
|
-
{
|
|
46
|
-
"ruleId": "no-secrets",
|
|
47
|
-
"level": "error",
|
|
48
|
-
"message": {
|
|
49
|
-
"text": "Hardcoded secret detected"
|
|
50
|
-
},
|
|
51
|
-
"locations": [
|
|
52
|
-
{
|
|
53
|
-
"physicalLocation": {
|
|
54
|
-
"artifactLocation": {
|
|
55
|
-
"uri": "src/a.ts",
|
|
56
|
-
"uriBaseId": "%SRCROOT%"
|
|
57
|
-
},
|
|
58
|
-
"region": {
|
|
59
|
-
"startLine": 10
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
],
|
|
64
|
-
"fixes": [
|
|
65
|
-
{
|
|
66
|
-
"description": {
|
|
67
|
-
"text": "Use environment variables"
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
"ruleId": "style-warning",
|
|
74
|
-
"level": "warning",
|
|
75
|
-
"message": {
|
|
76
|
-
"text": "Potentially confusing naming"
|
|
77
|
-
},
|
|
78
|
-
"locations": [
|
|
79
|
-
{
|
|
80
|
-
"physicalLocation": {
|
|
81
|
-
"artifactLocation": {
|
|
82
|
-
"uri": "src/b.ts",
|
|
83
|
-
"uriBaseId": "%SRCROOT%"
|
|
84
|
-
},
|
|
85
|
-
"region": {
|
|
86
|
-
"startLine": 3
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
]
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
"ruleId": "info-note",
|
|
94
|
-
"level": "note",
|
|
95
|
-
"message": {
|
|
96
|
-
"text": "Informational hint"
|
|
97
|
-
},
|
|
98
|
-
"locations": [
|
|
99
|
-
{
|
|
100
|
-
"physicalLocation": {
|
|
101
|
-
"artifactLocation": {
|
|
102
|
-
"uri": "src/c.ts",
|
|
103
|
-
"uriBaseId": "%SRCROOT%"
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
]
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
"ruleId": "no-secrets",
|
|
111
|
-
"level": "error",
|
|
112
|
-
"message": {
|
|
113
|
-
"text": "Another secret"
|
|
114
|
-
},
|
|
115
|
-
"locations": [
|
|
116
|
-
{
|
|
117
|
-
"physicalLocation": {
|
|
118
|
-
"artifactLocation": {
|
|
119
|
-
"uri": "src/d.ts",
|
|
120
|
-
"uriBaseId": "%SRCROOT%"
|
|
121
|
-
},
|
|
122
|
-
"region": {
|
|
123
|
-
"startLine": 20
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
]
|
|
130
|
-
}
|
|
131
|
-
]
|
|
132
|
-
},
|
|
133
|
-
"toSarif includes optional fix and region only when provided": {
|
|
134
|
-
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
|
|
135
|
-
"version": "2.1.0",
|
|
136
|
-
"runs": [
|
|
137
|
-
{
|
|
138
|
-
"tool": {
|
|
139
|
-
"driver": {
|
|
140
|
-
"name": "guardrail",
|
|
141
|
-
"version": "1.2.3",
|
|
142
|
-
"informationUri": "https://github.com/axledbetter/guardrail",
|
|
143
|
-
"rules": [
|
|
144
|
-
{
|
|
145
|
-
"id": "cat-a",
|
|
146
|
-
"name": "cat-a",
|
|
147
|
-
"shortDescription": {
|
|
148
|
-
"text": "cat-a"
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
"id": "cat-b",
|
|
153
|
-
"name": "cat-b",
|
|
154
|
-
"shortDescription": {
|
|
155
|
-
"text": "cat-b"
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
]
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
"results": [
|
|
162
|
-
{
|
|
163
|
-
"ruleId": "cat-a",
|
|
164
|
-
"level": "warning",
|
|
165
|
-
"message": {
|
|
166
|
-
"text": "Has line and suggestion"
|
|
167
|
-
},
|
|
168
|
-
"locations": [
|
|
169
|
-
{
|
|
170
|
-
"physicalLocation": {
|
|
171
|
-
"artifactLocation": {
|
|
172
|
-
"uri": "src/with.ts",
|
|
173
|
-
"uriBaseId": "%SRCROOT%"
|
|
174
|
-
},
|
|
175
|
-
"region": {
|
|
176
|
-
"startLine": 42
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
],
|
|
181
|
-
"fixes": [
|
|
182
|
-
{
|
|
183
|
-
"description": {
|
|
184
|
-
"text": "Apply quick fix"
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
]
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
"ruleId": "cat-b",
|
|
191
|
-
"level": "warning",
|
|
192
|
-
"message": {
|
|
193
|
-
"text": "No line no suggestion"
|
|
194
|
-
},
|
|
195
|
-
"locations": [
|
|
196
|
-
{
|
|
197
|
-
"physicalLocation": {
|
|
198
|
-
"artifactLocation": {
|
|
199
|
-
"uri": "src/without.ts",
|
|
200
|
-
"uriBaseId": "%SRCROOT%"
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
]
|
|
205
|
-
}
|
|
206
|
-
]
|
|
207
|
-
}
|
|
208
|
-
]
|
|
209
|
-
}
|
|
210
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"volume override triggers full run": {
|
|
3
|
-
"selected": [
|
|
4
|
-
"a.snap",
|
|
5
|
-
"b.snap",
|
|
6
|
-
"c.snap"
|
|
7
|
-
],
|
|
8
|
-
"fullRun": true,
|
|
9
|
-
"reason": "volume override (>10 files changed)"
|
|
10
|
-
},
|
|
11
|
-
"high-impact path match triggers full run": {
|
|
12
|
-
"selected": [
|
|
13
|
-
"x.snap",
|
|
14
|
-
"y.snap"
|
|
15
|
-
],
|
|
16
|
-
"fullRun": true,
|
|
17
|
-
"reason": "high-impact path matched: src/core/pipeline/runner.ts"
|
|
18
|
-
},
|
|
19
|
-
"selects snapshots via direct and importer mapping": {
|
|
20
|
-
"selected": [
|
|
21
|
-
"snap-a.snap",
|
|
22
|
-
"snap-b.snap"
|
|
23
|
-
],
|
|
24
|
-
"fullRun": false,
|
|
25
|
-
"reason": "2 snapshot(s) selected"
|
|
26
|
-
},
|
|
27
|
-
"returns no matches reason when nothing selected": {
|
|
28
|
-
"selected": [],
|
|
29
|
-
"fullRun": false,
|
|
30
|
-
"reason": "no snapshots matched changed files"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"captures relative import and export-from edges": {
|
|
3
|
-
"feature/util.ts": [
|
|
4
|
-
"feature/index.ts"
|
|
5
|
-
]
|
|
6
|
-
},
|
|
7
|
-
"ignores non-relative imports and deduplicates importers per target": {
|
|
8
|
-
"lib/shared.ts": [
|
|
9
|
-
"a.ts",
|
|
10
|
-
"b.ts"
|
|
11
|
-
]
|
|
12
|
-
},
|
|
13
|
-
"excludes imports that resolve outside srcDir": {
|
|
14
|
-
"pkg/inside.ts": [
|
|
15
|
-
"pkg/consumer.ts"
|
|
16
|
-
],
|
|
17
|
-
"outside.ts": [
|
|
18
|
-
"pkg/consumer.ts"
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"normalizes timestamps uuids and cwd-prefixed paths": {
|
|
3
|
-
"id": "<uuid>",
|
|
4
|
-
"path": "src/index.ts",
|
|
5
|
-
"ts": "<timestamp>",
|
|
6
|
-
"untouched": "/other/place/file.ts"
|
|
7
|
-
},
|
|
8
|
-
"recursively normalizes arrays and nested objects": {
|
|
9
|
-
"items": [
|
|
10
|
-
"<timestamp>",
|
|
11
|
-
{
|
|
12
|
-
"file": "a/b.txt",
|
|
13
|
-
"uid": "<uuid>"
|
|
14
|
-
},
|
|
15
|
-
[
|
|
16
|
-
"plain",
|
|
17
|
-
"c/d.ts"
|
|
18
|
-
]
|
|
19
|
-
]
|
|
20
|
-
},
|
|
21
|
-
"sorts object keys deterministically at all levels": {
|
|
22
|
-
"a": {
|
|
23
|
-
"b": 2,
|
|
24
|
-
"c": 3,
|
|
25
|
-
"d": 4
|
|
26
|
-
},
|
|
27
|
-
"m": [
|
|
28
|
-
{
|
|
29
|
-
"x": 1,
|
|
30
|
-
"y": 2
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"a": 1,
|
|
34
|
-
"b": 2
|
|
35
|
-
}
|
|
36
|
-
],
|
|
37
|
-
"z": 1
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"src/core/errors.ts": [
|
|
3
|
-
"src/adapters/loader.ts",
|
|
4
|
-
"src/adapters/review-engine/codex.ts",
|
|
5
|
-
"src/adapters/vcs-host/github.ts",
|
|
6
|
-
"src/core/config/loader.ts",
|
|
7
|
-
"src/core/config/preset-resolver.ts",
|
|
8
|
-
"src/core/runtime/lock.ts",
|
|
9
|
-
"src/core/runtime/state.ts",
|
|
10
|
-
"src/core/shell.ts"
|
|
11
|
-
],
|
|
12
|
-
"src/adapters/base.ts": [
|
|
13
|
-
"src/adapters/loader.ts",
|
|
14
|
-
"src/adapters/migration-runner/supabase.ts",
|
|
15
|
-
"src/adapters/migration-runner/types.ts",
|
|
16
|
-
"src/adapters/review-bot-parser/declarative-base.ts",
|
|
17
|
-
"src/adapters/review-bot-parser/types.ts",
|
|
18
|
-
"src/adapters/review-engine/codex.ts",
|
|
19
|
-
"src/adapters/review-engine/types.ts",
|
|
20
|
-
"src/adapters/vcs-host/github.ts",
|
|
21
|
-
"src/adapters/vcs-host/types.ts",
|
|
22
|
-
"src/core/cache/cached-engine.ts"
|
|
23
|
-
],
|
|
24
|
-
"src/core/shell.ts": [
|
|
25
|
-
"src/adapters/migration-runner/supabase.ts",
|
|
26
|
-
"src/adapters/vcs-host/github.ts",
|
|
27
|
-
"src/cli/preflight.ts",
|
|
28
|
-
"src/core/git/touched-files.ts"
|
|
29
|
-
],
|
|
30
|
-
"src/adapters/migration-runner/types.ts": [
|
|
31
|
-
"src/adapters/migration-runner/supabase.ts"
|
|
32
|
-
],
|
|
33
|
-
"src/adapters/review-bot-parser/declarative-base.ts": [
|
|
34
|
-
"src/adapters/review-bot-parser/cursor.ts"
|
|
35
|
-
],
|
|
36
|
-
"src/core/findings/types.ts": [
|
|
37
|
-
"src/adapters/review-bot-parser/declarative-base.ts",
|
|
38
|
-
"src/adapters/review-bot-parser/types.ts",
|
|
39
|
-
"src/adapters/review-engine/codex.ts",
|
|
40
|
-
"src/adapters/review-engine/types.ts",
|
|
41
|
-
"src/core/findings/dedup.ts",
|
|
42
|
-
"src/core/phases/static-rules.ts",
|
|
43
|
-
"src/core/phases/tests.ts",
|
|
44
|
-
"src/core/pipeline/review-phase.ts",
|
|
45
|
-
"src/core/pipeline/run.ts",
|
|
46
|
-
"src/formatters/github-annotations.ts",
|
|
47
|
-
"src/formatters/sarif.ts"
|
|
48
|
-
],
|
|
49
|
-
"src/adapters/vcs-host/types.ts": [
|
|
50
|
-
"src/adapters/review-bot-parser/declarative-base.ts",
|
|
51
|
-
"src/adapters/review-bot-parser/types.ts",
|
|
52
|
-
"src/adapters/vcs-host/github.ts"
|
|
53
|
-
],
|
|
54
|
-
"src/adapters/review-bot-parser/types.ts": [
|
|
55
|
-
"src/adapters/review-bot-parser/declarative-base.ts"
|
|
56
|
-
],
|
|
57
|
-
"src/adapters/review-engine/types.ts": [
|
|
58
|
-
"src/adapters/review-engine/codex.ts",
|
|
59
|
-
"src/cli/run.ts",
|
|
60
|
-
"src/cli/watch.ts",
|
|
61
|
-
"src/core/cache/cached-engine.ts",
|
|
62
|
-
"src/core/cache/review-cache.ts",
|
|
63
|
-
"src/core/chunking/index.ts",
|
|
64
|
-
"src/core/pipeline/review-phase.ts",
|
|
65
|
-
"src/core/pipeline/run.ts"
|
|
66
|
-
],
|
|
67
|
-
"src/cli/init.ts": [
|
|
68
|
-
"src/cli/index.ts"
|
|
69
|
-
],
|
|
70
|
-
"src/cli/run.ts": [
|
|
71
|
-
"src/cli/index.ts"
|
|
72
|
-
],
|
|
73
|
-
"src/cli/watch.ts": [
|
|
74
|
-
"src/cli/index.ts"
|
|
75
|
-
],
|
|
76
|
-
"src/core/config/loader.ts": [
|
|
77
|
-
"src/cli/run.ts",
|
|
78
|
-
"src/cli/watch.ts",
|
|
79
|
-
"src/core/config/preset-resolver.ts"
|
|
80
|
-
],
|
|
81
|
-
"src/core/config/preset-resolver.ts": [
|
|
82
|
-
"src/cli/run.ts",
|
|
83
|
-
"src/cli/watch.ts"
|
|
84
|
-
],
|
|
85
|
-
"src/adapters/loader.ts": [
|
|
86
|
-
"src/cli/run.ts",
|
|
87
|
-
"src/cli/watch.ts"
|
|
88
|
-
],
|
|
89
|
-
"src/core/pipeline/run.ts": [
|
|
90
|
-
"src/cli/run.ts",
|
|
91
|
-
"src/cli/watch.ts",
|
|
92
|
-
"src/formatters/sarif.ts"
|
|
93
|
-
],
|
|
94
|
-
"src/core/git/touched-files.ts": [
|
|
95
|
-
"src/cli/run.ts"
|
|
96
|
-
],
|
|
97
|
-
"src/core/config/types.ts": [
|
|
98
|
-
"src/cli/run.ts",
|
|
99
|
-
"src/cli/watch.ts",
|
|
100
|
-
"src/core/chunking/index.ts",
|
|
101
|
-
"src/core/config/loader.ts",
|
|
102
|
-
"src/core/config/preset-resolver.ts",
|
|
103
|
-
"src/core/pipeline/review-phase.ts",
|
|
104
|
-
"src/core/pipeline/run.ts"
|
|
105
|
-
],
|
|
106
|
-
"src/formatters/sarif.ts": [
|
|
107
|
-
"src/cli/run.ts",
|
|
108
|
-
"src/formatters/index.ts"
|
|
109
|
-
],
|
|
110
|
-
"src/formatters/github-annotations.ts": [
|
|
111
|
-
"src/cli/run.ts",
|
|
112
|
-
"src/formatters/index.ts"
|
|
113
|
-
],
|
|
114
|
-
"src/core/cache/review-cache.ts": [
|
|
115
|
-
"src/core/cache/cached-engine.ts"
|
|
116
|
-
],
|
|
117
|
-
"src/core/config/schema.ts": [
|
|
118
|
-
"src/core/config/loader.ts"
|
|
119
|
-
],
|
|
120
|
-
"src/core/logging/redaction.ts": [
|
|
121
|
-
"src/core/logging/ndjson-writer.ts"
|
|
122
|
-
],
|
|
123
|
-
"src/core/findings/dedup.ts": [
|
|
124
|
-
"src/core/phases/static-rules.ts"
|
|
125
|
-
],
|
|
126
|
-
"src/core/chunking/index.ts": [
|
|
127
|
-
"src/core/pipeline/review-phase.ts"
|
|
128
|
-
],
|
|
129
|
-
"src/core/phases/static-rules.ts": [
|
|
130
|
-
"src/core/pipeline/run.ts"
|
|
131
|
-
],
|
|
132
|
-
"src/core/phases/tests.ts": [
|
|
133
|
-
"src/core/pipeline/run.ts"
|
|
134
|
-
],
|
|
135
|
-
"src/core/pipeline/review-phase.ts": [
|
|
136
|
-
"src/core/pipeline/run.ts"
|
|
137
|
-
]
|
|
138
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"tests/snapshots/src-formatters-sarif.snap.ts": [
|
|
3
|
-
"src/formatters/sarif.ts"
|
|
4
|
-
],
|
|
5
|
-
"tests/snapshots/src-snapshots-impact-selector.snap.ts": [
|
|
6
|
-
"scripts/snapshots/impact-selector.ts"
|
|
7
|
-
],
|
|
8
|
-
"tests/snapshots/src-snapshots-import-scanner.snap.ts": [
|
|
9
|
-
"scripts/snapshots/import-scanner.ts"
|
|
10
|
-
],
|
|
11
|
-
"tests/snapshots/src-snapshots-serializer.snap.ts": [
|
|
12
|
-
"scripts/snapshots/serializer.ts"
|
|
13
|
-
]
|
|
14
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
// @snapshot-for: src/formatters/sarif.ts
|
|
2
|
-
// @generated-at: 2026-04-21T17:42:06.431Z
|
|
3
|
-
// @source-commit: d207869
|
|
4
|
-
// @generator-version: 1.0.0-alpha.6
|
|
5
|
-
|
|
6
|
-
import fs from 'node:fs';
|
|
7
|
-
import { describe, it } from 'node:test';
|
|
8
|
-
import assert from 'node:assert/strict';
|
|
9
|
-
import { fileURLToPath } from 'node:url';
|
|
10
|
-
import * as path from 'node:path';
|
|
11
|
-
|
|
12
|
-
import { normalizeSarifUri, toSarif } from '../../src/formatters/sarif.ts';
|
|
13
|
-
import { normalizeSnapshot } from '../../scripts/snapshots/serializer.ts';
|
|
14
|
-
|
|
15
|
-
const SLUG = 'src-formatters-sarif';
|
|
16
|
-
const baselineRaw =
|
|
17
|
-
process.env.CAPTURE_BASELINE === '1'
|
|
18
|
-
? '{}'
|
|
19
|
-
: fs.readFileSync(
|
|
20
|
-
fileURLToPath(new URL('./baselines/src-formatters-sarif.json', import.meta.url)),
|
|
21
|
-
'utf8',
|
|
22
|
-
);
|
|
23
|
-
const baseline = JSON.parse(baselineRaw);
|
|
24
|
-
const captured: Record<string, unknown> = {};
|
|
25
|
-
process.on('exit', () => {
|
|
26
|
-
if (process.env.CAPTURE_BASELINE === '1') {
|
|
27
|
-
const p = process.env.AUTOREGRESS_TEMP_BASELINE_DIR
|
|
28
|
-
? path.join(process.env.AUTOREGRESS_TEMP_BASELINE_DIR, 'src-formatters-sarif.json')
|
|
29
|
-
: fileURLToPath(new URL('./baselines/src-formatters-sarif.json', import.meta.url));
|
|
30
|
-
fs.writeFileSync(p, JSON.stringify(captured, null, 2), 'utf8');
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
describe(SLUG, () => {
|
|
35
|
-
it('normalizeSarifUri handles relative absolute and parent escaping paths', () => {
|
|
36
|
-
const cwd = '/repo';
|
|
37
|
-
const result = {
|
|
38
|
-
rel: normalizeSarifUri('src/index.ts', cwd),
|
|
39
|
-
absInside: normalizeSarifUri('/repo/lib/file.ts', cwd),
|
|
40
|
-
absOutside: normalizeSarifUri('/other/place/file.ts', cwd),
|
|
41
|
-
dotted: normalizeSarifUri('./scripts/run.ts', cwd),
|
|
42
|
-
windows: normalizeSarifUri('folder\\nested\\file.ts', cwd),
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
if (process.env.CAPTURE_BASELINE === '1') {
|
|
46
|
-
captured['normalizeSarifUri handles relative absolute and parent escaping paths'] = result;
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
assert.equal(
|
|
50
|
-
normalizeSnapshot(result),
|
|
51
|
-
normalizeSnapshot(baseline['normalizeSarifUri handles relative absolute and parent escaping paths']),
|
|
52
|
-
);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('toSarif emits schema tool metadata rules and mapped severities', () => {
|
|
56
|
-
const runResult = {
|
|
57
|
-
allFindings: [
|
|
58
|
-
{
|
|
59
|
-
category: 'no-secrets',
|
|
60
|
-
severity: 'critical',
|
|
61
|
-
message: 'Hardcoded secret detected',
|
|
62
|
-
file: '/repo/src/a.ts',
|
|
63
|
-
line: 10,
|
|
64
|
-
suggestion: 'Use environment variables',
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
category: 'style-warning',
|
|
68
|
-
severity: 'warning',
|
|
69
|
-
message: 'Potentially confusing naming',
|
|
70
|
-
file: '/repo/src/b.ts',
|
|
71
|
-
line: 3,
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
category: 'info-note',
|
|
75
|
-
severity: 'info',
|
|
76
|
-
message: 'Informational hint',
|
|
77
|
-
file: '/repo/src/c.ts',
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
category: 'no-secrets',
|
|
81
|
-
severity: 'critical',
|
|
82
|
-
message: 'Another secret',
|
|
83
|
-
file: '/repo/src/d.ts',
|
|
84
|
-
line: 20,
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
} as any;
|
|
88
|
-
|
|
89
|
-
const result = toSarif(runResult, { toolVersion: '9.9.9', cwd: '/repo' });
|
|
90
|
-
|
|
91
|
-
if (process.env.CAPTURE_BASELINE === '1') {
|
|
92
|
-
captured['toSarif emits schema tool metadata rules and mapped severities'] = result;
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
assert.equal(
|
|
96
|
-
normalizeSnapshot(result),
|
|
97
|
-
normalizeSnapshot(baseline['toSarif emits schema tool metadata rules and mapped severities']),
|
|
98
|
-
);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('toSarif includes optional fix and region only when provided', () => {
|
|
102
|
-
const runResult = {
|
|
103
|
-
allFindings: [
|
|
104
|
-
{
|
|
105
|
-
category: 'cat-a',
|
|
106
|
-
severity: 'warning',
|
|
107
|
-
message: 'Has line and suggestion',
|
|
108
|
-
file: 'src/with.ts',
|
|
109
|
-
line: 42,
|
|
110
|
-
suggestion: 'Apply quick fix',
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
category: 'cat-b',
|
|
114
|
-
severity: 'warning',
|
|
115
|
-
message: 'No line no suggestion',
|
|
116
|
-
file: 'src/without.ts',
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
} as any;
|
|
120
|
-
|
|
121
|
-
const result = toSarif(runResult, { toolVersion: '1.2.3', cwd: '/repo' });
|
|
122
|
-
|
|
123
|
-
if (process.env.CAPTURE_BASELINE === '1') {
|
|
124
|
-
captured['toSarif includes optional fix and region only when provided'] = result;
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
assert.equal(
|
|
128
|
-
normalizeSnapshot(result),
|
|
129
|
-
normalizeSnapshot(baseline['toSarif includes optional fix and region only when provided']),
|
|
130
|
-
);
|
|
131
|
-
});
|
|
132
|
-
});
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
// @snapshot-for: scripts/snapshots/impact-selector.ts
|
|
2
|
-
// @generated-at: 2026-04-21T17:42:06.431Z
|
|
3
|
-
// @source-commit: d207869
|
|
4
|
-
// @generator-version: 1.0.0-alpha.6
|
|
5
|
-
|
|
6
|
-
import fs from 'node:fs';
|
|
7
|
-
import { describe, it } from 'node:test';
|
|
8
|
-
import assert from 'node:assert/strict';
|
|
9
|
-
import { fileURLToPath } from 'node:url';
|
|
10
|
-
import * as path from 'node:path';
|
|
11
|
-
|
|
12
|
-
import { selectSnapshots } from '../../scripts/snapshots/impact-selector.ts';
|
|
13
|
-
import { normalizeSnapshot } from '../../scripts/snapshots/serializer.ts';
|
|
14
|
-
|
|
15
|
-
const SLUG = 'src-snapshots-impact-selector';
|
|
16
|
-
const baselineRaw = process.env.CAPTURE_BASELINE === '1' ? '{}' : fs.readFileSync(fileURLToPath(new URL('./baselines/src-snapshots-impact-selector.json', import.meta.url)), 'utf8');
|
|
17
|
-
const baseline = JSON.parse(baselineRaw);
|
|
18
|
-
const captured: Record<string, unknown> = {};
|
|
19
|
-
|
|
20
|
-
process.on('exit', () => {
|
|
21
|
-
if (process.env.CAPTURE_BASELINE === '1') {
|
|
22
|
-
const p = process.env.AUTOREGRESS_TEMP_BASELINE_DIR
|
|
23
|
-
? path.join(process.env.AUTOREGRESS_TEMP_BASELINE_DIR, 'src-snapshots-impact-selector.json')
|
|
24
|
-
: fileURLToPath(new URL('./baselines/src-snapshots-impact-selector.json', import.meta.url));
|
|
25
|
-
fs.writeFileSync(p, JSON.stringify(captured, null, 2), 'utf8');
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
describe(SLUG, () => {
|
|
30
|
-
it('volume override triggers full run', () => {
|
|
31
|
-
const changedFiles = Array.from({ length: 11 }, (_, i) => `src/feature/file-${i}.ts`);
|
|
32
|
-
const allSnapshotFiles = ['a.snap', 'b.snap', 'c.snap'];
|
|
33
|
-
|
|
34
|
-
const result = selectSnapshots(changedFiles, allSnapshotFiles, {}, {}, {});
|
|
35
|
-
|
|
36
|
-
if (process.env.CAPTURE_BASELINE === '1') {
|
|
37
|
-
captured['volume override triggers full run'] = result;
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
assert.equal(normalizeSnapshot(result), normalizeSnapshot(baseline['volume override triggers full run']));
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('high-impact path match triggers full run', () => {
|
|
44
|
-
const changedFiles = ['src/core/pipeline/runner.ts'];
|
|
45
|
-
const allSnapshotFiles = ['x.snap', 'y.snap'];
|
|
46
|
-
|
|
47
|
-
const result = selectSnapshots(changedFiles, allSnapshotFiles, {}, {}, {});
|
|
48
|
-
|
|
49
|
-
if (process.env.CAPTURE_BASELINE === '1') {
|
|
50
|
-
captured['high-impact path match triggers full run'] = result;
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
assert.equal(normalizeSnapshot(result), normalizeSnapshot(baseline['high-impact path match triggers full run']));
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('selects snapshots via direct and importer mapping', () => {
|
|
57
|
-
const changedFiles = ['src/features/a.ts'];
|
|
58
|
-
const allSnapshotFiles = ['snap-a.snap', 'snap-b.snap', 'snap-c.snap'];
|
|
59
|
-
const index = {
|
|
60
|
-
'snap-a.snap': ['src/features/a.ts'],
|
|
61
|
-
'snap-b.snap': ['src/features/b.ts'],
|
|
62
|
-
'snap-c.snap': ['src/features/c.ts'],
|
|
63
|
-
};
|
|
64
|
-
const importMap = {
|
|
65
|
-
'src/features/a.ts': ['src/features/b.ts'],
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const result = selectSnapshots(changedFiles, allSnapshotFiles, index, importMap, {
|
|
69
|
-
highImpactPatterns: [],
|
|
70
|
-
volumeThreshold: 50,
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
if (process.env.CAPTURE_BASELINE === '1') {
|
|
74
|
-
captured['selects snapshots via direct and importer mapping'] = result;
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
assert.equal(normalizeSnapshot(result), normalizeSnapshot(baseline['selects snapshots via direct and importer mapping']));
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('returns no matches reason when nothing selected', () => {
|
|
81
|
-
const result = selectSnapshots(
|
|
82
|
-
['src/unknown/file.ts'],
|
|
83
|
-
['only.snap'],
|
|
84
|
-
{ 'only.snap': ['src/other/file.ts'] },
|
|
85
|
-
{},
|
|
86
|
-
{ highImpactPatterns: [], volumeThreshold: 50 },
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
if (process.env.CAPTURE_BASELINE === '1') {
|
|
90
|
-
captured['returns no matches reason when nothing selected'] = result;
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
assert.equal(normalizeSnapshot(result), normalizeSnapshot(baseline['returns no matches reason when nothing selected']));
|
|
94
|
-
});
|
|
95
|
-
});
|