@akasecurity/ai-tc-antigravity 0.9.4 → 0.9.6
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/package.json +4 -4
- package/plugin.json +1 -1
- package/scripts/apply-suppressions.js +61 -13
- package/scripts/backfill.js +62 -13
- package/scripts/filescan.js +73 -24
- package/scripts/firstrun.js +52 -8
- package/scripts/intro.js +49 -5
- package/scripts/onboard.js +49 -5
- package/scripts/post-tool-use.js +49 -5
- package/scripts/pre-invocation.js +86 -32
- package/scripts/pre-tool-use.js +62 -13
- package/scripts/query.js +54 -10
- package/scripts/reconcile.js +58 -10
- package/scripts/remediate.js +67 -18
- package/scripts/scan-worker.js +61 -12
- package/scripts/start-light.js +52 -8
- package/scripts/stop.js +49 -5
- package/skills/setup/SKILL.md +17 -0
package/scripts/onboard.js
CHANGED
|
@@ -26123,6 +26123,40 @@ function escapeRegExp2(value) {
|
|
|
26123
26123
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26124
26124
|
}
|
|
26125
26125
|
|
|
26126
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
26127
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
26128
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
26129
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
26130
|
+
function listCache(kind) {
|
|
26131
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
26132
|
+
}
|
|
26133
|
+
function memoizedRegExp(owner, build) {
|
|
26134
|
+
const cached2 = singles.get(owner);
|
|
26135
|
+
if (cached2 !== void 0) {
|
|
26136
|
+
cached2.lastIndex = 0;
|
|
26137
|
+
return cached2;
|
|
26138
|
+
}
|
|
26139
|
+
const compiled = build();
|
|
26140
|
+
singles.set(owner, compiled);
|
|
26141
|
+
return compiled;
|
|
26142
|
+
}
|
|
26143
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
26144
|
+
const cache = listCache(kind);
|
|
26145
|
+
const cached2 = cache.get(owner);
|
|
26146
|
+
if (cached2 !== void 0) {
|
|
26147
|
+
if (cached2.stateful) {
|
|
26148
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
26149
|
+
}
|
|
26150
|
+
return cached2.entries;
|
|
26151
|
+
}
|
|
26152
|
+
const entries = build();
|
|
26153
|
+
cache.set(owner, {
|
|
26154
|
+
entries,
|
|
26155
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
26156
|
+
});
|
|
26157
|
+
return entries;
|
|
26158
|
+
}
|
|
26159
|
+
|
|
26126
26160
|
// ../../packages/detections/src/matchers/limits.ts
|
|
26127
26161
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
26128
26162
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -26133,10 +26167,17 @@ var KeywordMatcher2 = class {
|
|
|
26133
26167
|
if (rule.matcher.type !== "keyword") return [];
|
|
26134
26168
|
const { keywords, caseSensitive } = rule.matcher;
|
|
26135
26169
|
const spans = [];
|
|
26136
|
-
|
|
26137
|
-
|
|
26170
|
+
const compiled = memoizedRegExpList(
|
|
26171
|
+
"keyword",
|
|
26172
|
+
rule.matcher,
|
|
26173
|
+
() => keywords.map((kw) => {
|
|
26174
|
+
if (kw.length === 0) return void 0;
|
|
26175
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26176
|
+
})
|
|
26177
|
+
);
|
|
26178
|
+
for (const re of compiled) {
|
|
26179
|
+
if (re === void 0) continue;
|
|
26138
26180
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
26139
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26140
26181
|
let m;
|
|
26141
26182
|
while ((m = re.exec(text)) !== null) {
|
|
26142
26183
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -26152,7 +26193,10 @@ var RegexMatcher2 = class {
|
|
|
26152
26193
|
match(text, rule) {
|
|
26153
26194
|
if (rule.matcher.type !== "regex") return [];
|
|
26154
26195
|
const { pattern, flags: flags2, captureGroup } = rule.matcher;
|
|
26155
|
-
const re =
|
|
26196
|
+
const re = memoizedRegExp(
|
|
26197
|
+
rule.matcher,
|
|
26198
|
+
() => new RegExp(pattern, flags2.includes("d") ? flags2 : `${flags2}d`)
|
|
26199
|
+
);
|
|
26156
26200
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
26157
26201
|
const spans = [];
|
|
26158
26202
|
let m;
|
|
@@ -26295,7 +26339,7 @@ function applyCategoryPosture(posture, repo, mode = "fill-gaps") {
|
|
|
26295
26339
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
26296
26340
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
26297
26341
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
26298
|
-
import { basename as basename5, join as join12
|
|
26342
|
+
import { basename as basename5, join as join12 } from "path";
|
|
26299
26343
|
|
|
26300
26344
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
26301
26345
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
package/scripts/post-tool-use.js
CHANGED
|
@@ -18395,6 +18395,40 @@ function escapeRegExp2(value) {
|
|
|
18395
18395
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
18396
18396
|
}
|
|
18397
18397
|
|
|
18398
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
18399
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
18400
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
18401
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
18402
|
+
function listCache(kind) {
|
|
18403
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
18404
|
+
}
|
|
18405
|
+
function memoizedRegExp(owner, build) {
|
|
18406
|
+
const cached2 = singles.get(owner);
|
|
18407
|
+
if (cached2 !== void 0) {
|
|
18408
|
+
cached2.lastIndex = 0;
|
|
18409
|
+
return cached2;
|
|
18410
|
+
}
|
|
18411
|
+
const compiled = build();
|
|
18412
|
+
singles.set(owner, compiled);
|
|
18413
|
+
return compiled;
|
|
18414
|
+
}
|
|
18415
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
18416
|
+
const cache = listCache(kind);
|
|
18417
|
+
const cached2 = cache.get(owner);
|
|
18418
|
+
if (cached2 !== void 0) {
|
|
18419
|
+
if (cached2.stateful) {
|
|
18420
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
18421
|
+
}
|
|
18422
|
+
return cached2.entries;
|
|
18423
|
+
}
|
|
18424
|
+
const entries = build();
|
|
18425
|
+
cache.set(owner, {
|
|
18426
|
+
entries,
|
|
18427
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
18428
|
+
});
|
|
18429
|
+
return entries;
|
|
18430
|
+
}
|
|
18431
|
+
|
|
18398
18432
|
// ../../packages/detections/src/matchers/limits.ts
|
|
18399
18433
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
18400
18434
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -18405,10 +18439,17 @@ var KeywordMatcher2 = class {
|
|
|
18405
18439
|
if (rule.matcher.type !== "keyword") return [];
|
|
18406
18440
|
const { keywords, caseSensitive } = rule.matcher;
|
|
18407
18441
|
const spans = [];
|
|
18408
|
-
|
|
18409
|
-
|
|
18442
|
+
const compiled = memoizedRegExpList(
|
|
18443
|
+
"keyword",
|
|
18444
|
+
rule.matcher,
|
|
18445
|
+
() => keywords.map((kw) => {
|
|
18446
|
+
if (kw.length === 0) return void 0;
|
|
18447
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
18448
|
+
})
|
|
18449
|
+
);
|
|
18450
|
+
for (const re of compiled) {
|
|
18451
|
+
if (re === void 0) continue;
|
|
18410
18452
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
18411
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
18412
18453
|
let m;
|
|
18413
18454
|
while ((m = re.exec(text)) !== null) {
|
|
18414
18455
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -18424,7 +18465,10 @@ var RegexMatcher2 = class {
|
|
|
18424
18465
|
match(text, rule) {
|
|
18425
18466
|
if (rule.matcher.type !== "regex") return [];
|
|
18426
18467
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
18427
|
-
const re =
|
|
18468
|
+
const re = memoizedRegExp(
|
|
18469
|
+
rule.matcher,
|
|
18470
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
18471
|
+
);
|
|
18428
18472
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
18429
18473
|
const spans = [];
|
|
18430
18474
|
let m;
|
|
@@ -18557,7 +18601,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
18557
18601
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
18558
18602
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
18559
18603
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
18560
|
-
import { basename as basename5, join as join12
|
|
18604
|
+
import { basename as basename5, join as join12 } from "path";
|
|
18561
18605
|
|
|
18562
18606
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
18563
18607
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
@@ -26049,6 +26049,40 @@ function escapeRegExp2(value) {
|
|
|
26049
26049
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26050
26050
|
}
|
|
26051
26051
|
|
|
26052
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
26053
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
26054
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
26055
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
26056
|
+
function listCache(kind) {
|
|
26057
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
26058
|
+
}
|
|
26059
|
+
function memoizedRegExp(owner, build) {
|
|
26060
|
+
const cached2 = singles.get(owner);
|
|
26061
|
+
if (cached2 !== void 0) {
|
|
26062
|
+
cached2.lastIndex = 0;
|
|
26063
|
+
return cached2;
|
|
26064
|
+
}
|
|
26065
|
+
const compiled = build();
|
|
26066
|
+
singles.set(owner, compiled);
|
|
26067
|
+
return compiled;
|
|
26068
|
+
}
|
|
26069
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
26070
|
+
const cache = listCache(kind);
|
|
26071
|
+
const cached2 = cache.get(owner);
|
|
26072
|
+
if (cached2 !== void 0) {
|
|
26073
|
+
if (cached2.stateful) {
|
|
26074
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
26075
|
+
}
|
|
26076
|
+
return cached2.entries;
|
|
26077
|
+
}
|
|
26078
|
+
const entries = build();
|
|
26079
|
+
cache.set(owner, {
|
|
26080
|
+
entries,
|
|
26081
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
26082
|
+
});
|
|
26083
|
+
return entries;
|
|
26084
|
+
}
|
|
26085
|
+
|
|
26052
26086
|
// ../../packages/detections/src/matchers/limits.ts
|
|
26053
26087
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
26054
26088
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -26059,10 +26093,17 @@ var KeywordMatcher2 = class {
|
|
|
26059
26093
|
if (rule.matcher.type !== "keyword") return [];
|
|
26060
26094
|
const { keywords, caseSensitive } = rule.matcher;
|
|
26061
26095
|
const spans = [];
|
|
26062
|
-
|
|
26063
|
-
|
|
26096
|
+
const compiled = memoizedRegExpList(
|
|
26097
|
+
"keyword",
|
|
26098
|
+
rule.matcher,
|
|
26099
|
+
() => keywords.map((kw) => {
|
|
26100
|
+
if (kw.length === 0) return void 0;
|
|
26101
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26102
|
+
})
|
|
26103
|
+
);
|
|
26104
|
+
for (const re of compiled) {
|
|
26105
|
+
if (re === void 0) continue;
|
|
26064
26106
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
26065
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26066
26107
|
let m;
|
|
26067
26108
|
while ((m = re.exec(text)) !== null) {
|
|
26068
26109
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -26078,7 +26119,10 @@ var RegexMatcher2 = class {
|
|
|
26078
26119
|
match(text, rule) {
|
|
26079
26120
|
if (rule.matcher.type !== "regex") return [];
|
|
26080
26121
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
26081
|
-
const re =
|
|
26122
|
+
const re = memoizedRegExp(
|
|
26123
|
+
rule.matcher,
|
|
26124
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
26125
|
+
);
|
|
26082
26126
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
26083
26127
|
const spans = [];
|
|
26084
26128
|
let m;
|
|
@@ -26186,11 +26230,15 @@ function isCorroborated(candidate, candidates, text) {
|
|
|
26186
26230
|
const labels = req.labels;
|
|
26187
26231
|
if (labels && labels.length > 0) {
|
|
26188
26232
|
const haystack = text.slice(Math.max(0, winStart), winEnd);
|
|
26189
|
-
for (const
|
|
26190
|
-
|
|
26191
|
-
|
|
26192
|
-
|
|
26193
|
-
|
|
26233
|
+
for (const re of memoizedRegExpList(
|
|
26234
|
+
"label",
|
|
26235
|
+
req,
|
|
26236
|
+
() => labels.map((label) => {
|
|
26237
|
+
const trimmed = label.trim();
|
|
26238
|
+
return trimmed.length === 0 ? void 0 : new RegExp(`(?<![A-Za-z0-9])${escapeRegExp2(trimmed)}(?![A-Za-z0-9])`, "i");
|
|
26239
|
+
})
|
|
26240
|
+
)) {
|
|
26241
|
+
if (re?.test(haystack)) return true;
|
|
26194
26242
|
}
|
|
26195
26243
|
}
|
|
26196
26244
|
return false;
|
|
@@ -29023,10 +29071,10 @@ function parseFrontmatter(raw) {
|
|
|
29023
29071
|
if (lines[0]?.trim() !== "---") return out;
|
|
29024
29072
|
for (const line of lines.slice(1)) {
|
|
29025
29073
|
if (line.trim() === "---") break;
|
|
29026
|
-
const
|
|
29027
|
-
if (
|
|
29028
|
-
const key = line.slice(0,
|
|
29029
|
-
const value = line.slice(
|
|
29074
|
+
const sep4 = line.indexOf(":");
|
|
29075
|
+
if (sep4 === -1) continue;
|
|
29076
|
+
const key = line.slice(0, sep4).trim();
|
|
29077
|
+
const value = line.slice(sep4 + 1).trim().replace(/^['"]|['"]$/g, "");
|
|
29030
29078
|
if (value === "") continue;
|
|
29031
29079
|
if (key === "name") out.name = value;
|
|
29032
29080
|
else if (key === "description") out.description = value;
|
|
@@ -29245,7 +29293,7 @@ import { basename as basename5, dirname as dirname3, sep as sep3 } from "path";
|
|
|
29245
29293
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
29246
29294
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
29247
29295
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
29248
|
-
import { basename as basename6, join as join12
|
|
29296
|
+
import { basename as basename6, join as join12 } from "path";
|
|
29249
29297
|
var SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
29250
29298
|
".git",
|
|
29251
29299
|
"node_modules",
|
|
@@ -29263,23 +29311,28 @@ var SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
|
29263
29311
|
".cache"
|
|
29264
29312
|
]);
|
|
29265
29313
|
var MAX_FILES = 2e4;
|
|
29266
|
-
function readIgnoreLayer(dir) {
|
|
29314
|
+
function readIgnoreLayer(dir, anchorLen) {
|
|
29267
29315
|
try {
|
|
29268
29316
|
const content = readFileSync8(join12(dir, ".gitignore"), "utf8");
|
|
29269
|
-
return {
|
|
29317
|
+
return { matcher: (0, import_ignore.default)().add(content), anchorLen };
|
|
29270
29318
|
} catch {
|
|
29271
29319
|
return void 0;
|
|
29272
29320
|
}
|
|
29273
29321
|
}
|
|
29274
|
-
function
|
|
29275
|
-
|
|
29276
|
-
|
|
29277
|
-
|
|
29278
|
-
|
|
29279
|
-
|
|
29280
|
-
|
|
29322
|
+
function relToAnchor(dirRel, anchorLen, name) {
|
|
29323
|
+
if (anchorLen === dirRel.length) return name;
|
|
29324
|
+
return `${dirRel.slice(anchorLen === 0 ? 0 : anchorLen + 1)}/${name}`;
|
|
29325
|
+
}
|
|
29326
|
+
function isIgnored(layers, dirRel, name, isDir) {
|
|
29327
|
+
const suffix = isDir ? "/" : "";
|
|
29328
|
+
for (let i = layers.length - 1; i >= 0; i--) {
|
|
29329
|
+
const layer = layers[i];
|
|
29330
|
+
if (layer === void 0) continue;
|
|
29331
|
+
const verdict = layer.matcher.test(relToAnchor(dirRel, layer.anchorLen, name) + suffix);
|
|
29332
|
+
if (verdict.ignored) return true;
|
|
29333
|
+
if (verdict.unignored) return false;
|
|
29281
29334
|
}
|
|
29282
|
-
return
|
|
29335
|
+
return false;
|
|
29283
29336
|
}
|
|
29284
29337
|
var GENERATED_FILES = /* @__PURE__ */ new Set([
|
|
29285
29338
|
"pnpm-lock.yaml",
|
|
@@ -29332,7 +29385,7 @@ function classifyOrigin(relPath, name) {
|
|
|
29332
29385
|
}
|
|
29333
29386
|
function resolveProjectFiles(cwd) {
|
|
29334
29387
|
try {
|
|
29335
|
-
let visit2 = function(dir, layers) {
|
|
29388
|
+
let visit2 = function(dir, dirRel, layers) {
|
|
29336
29389
|
let dirents;
|
|
29337
29390
|
try {
|
|
29338
29391
|
dirents = readdirSync4(dir, { withFileTypes: true, encoding: "utf8" });
|
|
@@ -29340,21 +29393,22 @@ function resolveProjectFiles(cwd) {
|
|
|
29340
29393
|
walk.lostSubtree = true;
|
|
29341
29394
|
return false;
|
|
29342
29395
|
}
|
|
29343
|
-
const layer = readIgnoreLayer(dir);
|
|
29396
|
+
const layer = readIgnoreLayer(dir, dirRel.length);
|
|
29344
29397
|
const dirLayers = layer ? [...layers, layer] : layers;
|
|
29345
29398
|
for (const entry of dirents) {
|
|
29346
|
-
const fullPath = join12(dir, entry.name);
|
|
29347
29399
|
if (entry.isDirectory()) {
|
|
29348
|
-
if (SKIP_DIRS.has(entry.name) || isIgnored(dirLayers,
|
|
29400
|
+
if (SKIP_DIRS.has(entry.name) || isIgnored(dirLayers, dirRel, entry.name, true)) continue;
|
|
29401
|
+
const fullPath = join12(dir, entry.name);
|
|
29349
29402
|
if (existsSync8(join12(fullPath, ".git"))) continue;
|
|
29350
|
-
|
|
29403
|
+
const childRel = dirRel === "" ? entry.name : `${dirRel}/${entry.name}`;
|
|
29404
|
+
if (visit2(fullPath, childRel, dirLayers)) return true;
|
|
29351
29405
|
continue;
|
|
29352
29406
|
}
|
|
29353
29407
|
if (!entry.isFile()) continue;
|
|
29354
29408
|
if (entry.name === ".git") continue;
|
|
29355
|
-
if (isIgnored(dirLayers,
|
|
29409
|
+
if (isIgnored(dirLayers, dirRel, entry.name, false)) continue;
|
|
29356
29410
|
if (files.length >= MAX_FILES) return true;
|
|
29357
|
-
const relPath =
|
|
29411
|
+
const relPath = dirRel === "" ? entry.name : `${dirRel}/${entry.name}`;
|
|
29358
29412
|
files.push({
|
|
29359
29413
|
path: relPath,
|
|
29360
29414
|
name: basename6(entry.name),
|
|
@@ -29371,7 +29425,7 @@ function resolveProjectFiles(cwd) {
|
|
|
29371
29425
|
const isLinkedCheckout = resolveHeadRoot(cwd) !== worktree;
|
|
29372
29426
|
const files = [];
|
|
29373
29427
|
const walk = { lostSubtree: false };
|
|
29374
|
-
const truncated = visit2(root, []) || walk.lostSubtree || isLinkedCheckout;
|
|
29428
|
+
const truncated = visit2(root, "", []) || walk.lostSubtree || isLinkedCheckout;
|
|
29375
29429
|
if (files.length === 0) return void 0;
|
|
29376
29430
|
files.sort((a, b) => a.path.localeCompare(b.path));
|
|
29377
29431
|
return { files, truncated, scannedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
package/scripts/pre-tool-use.js
CHANGED
|
@@ -26077,6 +26077,40 @@ function escapeRegExp2(value) {
|
|
|
26077
26077
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26078
26078
|
}
|
|
26079
26079
|
|
|
26080
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
26081
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
26082
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
26083
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
26084
|
+
function listCache(kind) {
|
|
26085
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
26086
|
+
}
|
|
26087
|
+
function memoizedRegExp(owner, build) {
|
|
26088
|
+
const cached2 = singles.get(owner);
|
|
26089
|
+
if (cached2 !== void 0) {
|
|
26090
|
+
cached2.lastIndex = 0;
|
|
26091
|
+
return cached2;
|
|
26092
|
+
}
|
|
26093
|
+
const compiled = build();
|
|
26094
|
+
singles.set(owner, compiled);
|
|
26095
|
+
return compiled;
|
|
26096
|
+
}
|
|
26097
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
26098
|
+
const cache = listCache(kind);
|
|
26099
|
+
const cached2 = cache.get(owner);
|
|
26100
|
+
if (cached2 !== void 0) {
|
|
26101
|
+
if (cached2.stateful) {
|
|
26102
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
26103
|
+
}
|
|
26104
|
+
return cached2.entries;
|
|
26105
|
+
}
|
|
26106
|
+
const entries = build();
|
|
26107
|
+
cache.set(owner, {
|
|
26108
|
+
entries,
|
|
26109
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
26110
|
+
});
|
|
26111
|
+
return entries;
|
|
26112
|
+
}
|
|
26113
|
+
|
|
26080
26114
|
// ../../packages/detections/src/matchers/limits.ts
|
|
26081
26115
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
26082
26116
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -26087,10 +26121,17 @@ var KeywordMatcher2 = class {
|
|
|
26087
26121
|
if (rule.matcher.type !== "keyword") return [];
|
|
26088
26122
|
const { keywords, caseSensitive } = rule.matcher;
|
|
26089
26123
|
const spans = [];
|
|
26090
|
-
|
|
26091
|
-
|
|
26124
|
+
const compiled = memoizedRegExpList(
|
|
26125
|
+
"keyword",
|
|
26126
|
+
rule.matcher,
|
|
26127
|
+
() => keywords.map((kw) => {
|
|
26128
|
+
if (kw.length === 0) return void 0;
|
|
26129
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26130
|
+
})
|
|
26131
|
+
);
|
|
26132
|
+
for (const re of compiled) {
|
|
26133
|
+
if (re === void 0) continue;
|
|
26092
26134
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
26093
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26094
26135
|
let m;
|
|
26095
26136
|
while ((m = re.exec(text)) !== null) {
|
|
26096
26137
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -26106,7 +26147,10 @@ var RegexMatcher2 = class {
|
|
|
26106
26147
|
match(text, rule) {
|
|
26107
26148
|
if (rule.matcher.type !== "regex") return [];
|
|
26108
26149
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
26109
|
-
const re =
|
|
26150
|
+
const re = memoizedRegExp(
|
|
26151
|
+
rule.matcher,
|
|
26152
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
26153
|
+
);
|
|
26110
26154
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
26111
26155
|
const spans = [];
|
|
26112
26156
|
let m;
|
|
@@ -26214,11 +26258,15 @@ function isCorroborated(candidate, candidates, text) {
|
|
|
26214
26258
|
const labels = req.labels;
|
|
26215
26259
|
if (labels && labels.length > 0) {
|
|
26216
26260
|
const haystack = text.slice(Math.max(0, winStart), winEnd);
|
|
26217
|
-
for (const
|
|
26218
|
-
|
|
26219
|
-
|
|
26220
|
-
|
|
26221
|
-
|
|
26261
|
+
for (const re of memoizedRegExpList(
|
|
26262
|
+
"label",
|
|
26263
|
+
req,
|
|
26264
|
+
() => labels.map((label) => {
|
|
26265
|
+
const trimmed = label.trim();
|
|
26266
|
+
return trimmed.length === 0 ? void 0 : new RegExp(`(?<![A-Za-z0-9])${escapeRegExp2(trimmed)}(?![A-Za-z0-9])`, "i");
|
|
26267
|
+
})
|
|
26268
|
+
)) {
|
|
26269
|
+
if (re?.test(haystack)) return true;
|
|
26222
26270
|
}
|
|
26223
26271
|
}
|
|
26224
26272
|
return false;
|
|
@@ -26486,13 +26534,14 @@ function probesFor(rule) {
|
|
|
26486
26534
|
const derived = rule.matcher.type === "regex" ? derivedProbes(rule.matcher.pattern) : [];
|
|
26487
26535
|
return [...derived, ...EXPONENTIAL_PROBES, ...POLYNOMIAL_PROBES];
|
|
26488
26536
|
}
|
|
26489
|
-
|
|
26537
|
+
var wallClock = () => performance.now();
|
|
26538
|
+
function worstProbeMs(rule, now = wallClock) {
|
|
26490
26539
|
let ms = 0;
|
|
26491
26540
|
let probe = "";
|
|
26492
26541
|
for (const text of probesFor(rule)) {
|
|
26493
|
-
const start =
|
|
26542
|
+
const start = now();
|
|
26494
26543
|
scan(text, [rule]);
|
|
26495
|
-
const elapsed =
|
|
26544
|
+
const elapsed = now() - start;
|
|
26496
26545
|
if (elapsed > ms) {
|
|
26497
26546
|
ms = elapsed;
|
|
26498
26547
|
probe = text;
|
|
@@ -29110,7 +29159,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
29110
29159
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
29111
29160
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
29112
29161
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
29113
|
-
import { basename as basename5, join as join12
|
|
29162
|
+
import { basename as basename5, join as join12 } from "path";
|
|
29114
29163
|
|
|
29115
29164
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
29116
29165
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
package/scripts/query.js
CHANGED
|
@@ -25986,6 +25986,40 @@ function escapeRegExp2(value) {
|
|
|
25986
25986
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
25987
25987
|
}
|
|
25988
25988
|
|
|
25989
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
25990
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
25991
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
25992
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
25993
|
+
function listCache(kind) {
|
|
25994
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
25995
|
+
}
|
|
25996
|
+
function memoizedRegExp(owner, build) {
|
|
25997
|
+
const cached2 = singles.get(owner);
|
|
25998
|
+
if (cached2 !== void 0) {
|
|
25999
|
+
cached2.lastIndex = 0;
|
|
26000
|
+
return cached2;
|
|
26001
|
+
}
|
|
26002
|
+
const compiled = build();
|
|
26003
|
+
singles.set(owner, compiled);
|
|
26004
|
+
return compiled;
|
|
26005
|
+
}
|
|
26006
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
26007
|
+
const cache = listCache(kind);
|
|
26008
|
+
const cached2 = cache.get(owner);
|
|
26009
|
+
if (cached2 !== void 0) {
|
|
26010
|
+
if (cached2.stateful) {
|
|
26011
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
26012
|
+
}
|
|
26013
|
+
return cached2.entries;
|
|
26014
|
+
}
|
|
26015
|
+
const entries = build();
|
|
26016
|
+
cache.set(owner, {
|
|
26017
|
+
entries,
|
|
26018
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
26019
|
+
});
|
|
26020
|
+
return entries;
|
|
26021
|
+
}
|
|
26022
|
+
|
|
25989
26023
|
// ../../packages/detections/src/matchers/limits.ts
|
|
25990
26024
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
25991
26025
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -25996,10 +26030,17 @@ var KeywordMatcher2 = class {
|
|
|
25996
26030
|
if (rule.matcher.type !== "keyword") return [];
|
|
25997
26031
|
const { keywords, caseSensitive } = rule.matcher;
|
|
25998
26032
|
const spans = [];
|
|
25999
|
-
|
|
26000
|
-
|
|
26033
|
+
const compiled = memoizedRegExpList(
|
|
26034
|
+
"keyword",
|
|
26035
|
+
rule.matcher,
|
|
26036
|
+
() => keywords.map((kw) => {
|
|
26037
|
+
if (kw.length === 0) return void 0;
|
|
26038
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26039
|
+
})
|
|
26040
|
+
);
|
|
26041
|
+
for (const re of compiled) {
|
|
26042
|
+
if (re === void 0) continue;
|
|
26001
26043
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
26002
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26003
26044
|
let m;
|
|
26004
26045
|
while ((m = re.exec(text)) !== null) {
|
|
26005
26046
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -26015,7 +26056,10 @@ var RegexMatcher2 = class {
|
|
|
26015
26056
|
match(text, rule) {
|
|
26016
26057
|
if (rule.matcher.type !== "regex") return [];
|
|
26017
26058
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
26018
|
-
const re =
|
|
26059
|
+
const re = memoizedRegExp(
|
|
26060
|
+
rule.matcher,
|
|
26061
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
26062
|
+
);
|
|
26019
26063
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
26020
26064
|
const spans = [];
|
|
26021
26065
|
let m;
|
|
@@ -28173,7 +28217,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
28173
28217
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
28174
28218
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
28175
28219
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
28176
|
-
import { basename as basename5, join as join12
|
|
28220
|
+
import { basename as basename5, join as join12 } from "path";
|
|
28177
28221
|
|
|
28178
28222
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
28179
28223
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
@@ -28624,8 +28668,8 @@ function table(headers, rows, opts = {}) {
|
|
|
28624
28668
|
const widths = headers.map(
|
|
28625
28669
|
(h, i) => Math.max(visibleLength(h), ...rows.map((r) => visibleLength(r[i] ?? "")))
|
|
28626
28670
|
);
|
|
28627
|
-
const
|
|
28628
|
-
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(
|
|
28671
|
+
const sep4 = " ".repeat(gap);
|
|
28672
|
+
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(sep4);
|
|
28629
28673
|
const headerLine = fmt(headers.map((h) => h.toUpperCase()));
|
|
28630
28674
|
if (opts.rowSep === true) {
|
|
28631
28675
|
const fullWidth = widths.reduce((n, w) => n + w, 0) + gap * Math.max(0, widths.length - 1);
|
|
@@ -28637,7 +28681,7 @@ function table(headers, rows, opts = {}) {
|
|
|
28637
28681
|
});
|
|
28638
28682
|
return [headerLine, rule, ...body].join("\n");
|
|
28639
28683
|
}
|
|
28640
|
-
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(
|
|
28684
|
+
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(sep4);
|
|
28641
28685
|
return [headerLine, ruleLine, ...rows.map(fmt)].join("\n");
|
|
28642
28686
|
}
|
|
28643
28687
|
function fenced(body) {
|
|
@@ -28779,14 +28823,14 @@ function renderStatusBar(s, opts = {}) {
|
|
|
28779
28823
|
const unreviewed = `unreviewed ${SHADE.full}${String(u.critical)} ${SHADE.dark}${String(u.high)} ${SHADE.medium}${String(u.medium)} ${SHADE.light}${String(u.low)}`;
|
|
28780
28824
|
return `\u25B8\u25B8 AKA health ${String(s.score)}/100 ${unreviewed} \u2691 ${String(s.openFindings)} open findings`;
|
|
28781
28825
|
}
|
|
28782
|
-
const
|
|
28826
|
+
const sep4 = ` ${paint.dim("\u2502")} `;
|
|
28783
28827
|
const sq = "\u25A0";
|
|
28784
28828
|
const dot = s.score >= 80 ? paint.ok("\u25CF") : s.score >= 50 ? paint.high("\u25CF") : paint.critical("\u25CF");
|
|
28785
28829
|
const score = `${dot} health ${paint.bold(String(s.score))}${paint.dim("/100")}`;
|
|
28786
28830
|
const tally = `${paint.dim("unreviewed")} ${paint.critical(sq)}${String(u.critical)} ${paint.high(sq)}${String(u.high)} ${paint.medium(sq)}${String(u.medium)} ${paint.low(sq)}${String(u.low)}`;
|
|
28787
28831
|
const flag = s.openFindings > 0 ? paint.critical("\u2691") : paint.dim("\u2691");
|
|
28788
28832
|
const open2 = `${flag} ${String(s.openFindings)} open findings`;
|
|
28789
|
-
return `${paint.brand("\u25B8\u25B8 AKA")}${
|
|
28833
|
+
return `${paint.brand("\u25B8\u25B8 AKA")}${sep4}${score}${sep4}${tally}${sep4}${open2}`;
|
|
28790
28834
|
}
|
|
28791
28835
|
function findingStatus(summary) {
|
|
28792
28836
|
return {
|