@akasecurity/ai-tc-claude-code 0.9.5 → 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/.claude-plugin/plugin.json +1 -1
- package/commands/setup.md +23 -0
- package/package.json +4 -4
- package/scripts/apply-suppressions.js +61 -13
- package/scripts/backfill.js +64 -15
- package/scripts/filescan.js +73 -24
- package/scripts/firstrun.js +52 -8
- package/scripts/intro.js +49 -5
- package/scripts/message-display.js +58 -10
- package/scripts/onboard.js +49 -5
- package/scripts/post-tool-use.js +62 -13
- package/scripts/pre-tool-use.js +62 -13
- package/scripts/query.js +54 -10
- package/scripts/reconcile.js +60 -12
- package/scripts/remediate.js +67 -18
- package/scripts/scan-worker.js +61 -12
- package/scripts/session-start.js +86 -32
- package/scripts/start-light.js +52 -8
- package/scripts/statusline.js +51 -7
- package/scripts/stop.js +49 -5
- package/scripts/user-prompt-submit.js +175 -108
package/scripts/intro.js
CHANGED
|
@@ -18259,6 +18259,40 @@ function escapeRegExp2(value) {
|
|
|
18259
18259
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
18260
18260
|
}
|
|
18261
18261
|
|
|
18262
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
18263
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
18264
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
18265
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
18266
|
+
function listCache(kind) {
|
|
18267
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
18268
|
+
}
|
|
18269
|
+
function memoizedRegExp(owner, build) {
|
|
18270
|
+
const cached2 = singles.get(owner);
|
|
18271
|
+
if (cached2 !== void 0) {
|
|
18272
|
+
cached2.lastIndex = 0;
|
|
18273
|
+
return cached2;
|
|
18274
|
+
}
|
|
18275
|
+
const compiled = build();
|
|
18276
|
+
singles.set(owner, compiled);
|
|
18277
|
+
return compiled;
|
|
18278
|
+
}
|
|
18279
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
18280
|
+
const cache = listCache(kind);
|
|
18281
|
+
const cached2 = cache.get(owner);
|
|
18282
|
+
if (cached2 !== void 0) {
|
|
18283
|
+
if (cached2.stateful) {
|
|
18284
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
18285
|
+
}
|
|
18286
|
+
return cached2.entries;
|
|
18287
|
+
}
|
|
18288
|
+
const entries = build();
|
|
18289
|
+
cache.set(owner, {
|
|
18290
|
+
entries,
|
|
18291
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
18292
|
+
});
|
|
18293
|
+
return entries;
|
|
18294
|
+
}
|
|
18295
|
+
|
|
18262
18296
|
// ../../packages/detections/src/matchers/limits.ts
|
|
18263
18297
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
18264
18298
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -18269,10 +18303,17 @@ var KeywordMatcher2 = class {
|
|
|
18269
18303
|
if (rule.matcher.type !== "keyword") return [];
|
|
18270
18304
|
const { keywords, caseSensitive } = rule.matcher;
|
|
18271
18305
|
const spans = [];
|
|
18272
|
-
|
|
18273
|
-
|
|
18306
|
+
const compiled = memoizedRegExpList(
|
|
18307
|
+
"keyword",
|
|
18308
|
+
rule.matcher,
|
|
18309
|
+
() => keywords.map((kw) => {
|
|
18310
|
+
if (kw.length === 0) return void 0;
|
|
18311
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
18312
|
+
})
|
|
18313
|
+
);
|
|
18314
|
+
for (const re of compiled) {
|
|
18315
|
+
if (re === void 0) continue;
|
|
18274
18316
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
18275
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
18276
18317
|
let m;
|
|
18277
18318
|
while ((m = re.exec(text)) !== null) {
|
|
18278
18319
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -18288,7 +18329,10 @@ var RegexMatcher2 = class {
|
|
|
18288
18329
|
match(text, rule) {
|
|
18289
18330
|
if (rule.matcher.type !== "regex") return [];
|
|
18290
18331
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
18291
|
-
const re =
|
|
18332
|
+
const re = memoizedRegExp(
|
|
18333
|
+
rule.matcher,
|
|
18334
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
18335
|
+
);
|
|
18292
18336
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
18293
18337
|
const spans = [];
|
|
18294
18338
|
let m;
|
|
@@ -18421,7 +18465,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
18421
18465
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
18422
18466
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
18423
18467
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
18424
|
-
import { basename as basename5, join as join12
|
|
18468
|
+
import { basename as basename5, join as join12 } from "path";
|
|
18425
18469
|
|
|
18426
18470
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
18427
18471
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
@@ -26930,6 +26930,40 @@ function escapeRegExp2(value) {
|
|
|
26930
26930
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26931
26931
|
}
|
|
26932
26932
|
|
|
26933
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
26934
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
26935
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
26936
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
26937
|
+
function listCache(kind) {
|
|
26938
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
26939
|
+
}
|
|
26940
|
+
function memoizedRegExp(owner, build) {
|
|
26941
|
+
const cached2 = singles.get(owner);
|
|
26942
|
+
if (cached2 !== void 0) {
|
|
26943
|
+
cached2.lastIndex = 0;
|
|
26944
|
+
return cached2;
|
|
26945
|
+
}
|
|
26946
|
+
const compiled = build();
|
|
26947
|
+
singles.set(owner, compiled);
|
|
26948
|
+
return compiled;
|
|
26949
|
+
}
|
|
26950
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
26951
|
+
const cache = listCache(kind);
|
|
26952
|
+
const cached2 = cache.get(owner);
|
|
26953
|
+
if (cached2 !== void 0) {
|
|
26954
|
+
if (cached2.stateful) {
|
|
26955
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
26956
|
+
}
|
|
26957
|
+
return cached2.entries;
|
|
26958
|
+
}
|
|
26959
|
+
const entries = build();
|
|
26960
|
+
cache.set(owner, {
|
|
26961
|
+
entries,
|
|
26962
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
26963
|
+
});
|
|
26964
|
+
return entries;
|
|
26965
|
+
}
|
|
26966
|
+
|
|
26933
26967
|
// ../../packages/detections/src/matchers/limits.ts
|
|
26934
26968
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
26935
26969
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -26940,10 +26974,17 @@ var KeywordMatcher2 = class {
|
|
|
26940
26974
|
if (rule.matcher.type !== "keyword") return [];
|
|
26941
26975
|
const { keywords, caseSensitive } = rule.matcher;
|
|
26942
26976
|
const spans = [];
|
|
26943
|
-
|
|
26944
|
-
|
|
26977
|
+
const compiled = memoizedRegExpList(
|
|
26978
|
+
"keyword",
|
|
26979
|
+
rule.matcher,
|
|
26980
|
+
() => keywords.map((kw) => {
|
|
26981
|
+
if (kw.length === 0) return void 0;
|
|
26982
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26983
|
+
})
|
|
26984
|
+
);
|
|
26985
|
+
for (const re of compiled) {
|
|
26986
|
+
if (re === void 0) continue;
|
|
26945
26987
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
26946
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26947
26988
|
let m;
|
|
26948
26989
|
while ((m = re.exec(text)) !== null) {
|
|
26949
26990
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -26959,7 +27000,10 @@ var RegexMatcher2 = class {
|
|
|
26959
27000
|
match(text, rule) {
|
|
26960
27001
|
if (rule.matcher.type !== "regex") return [];
|
|
26961
27002
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
26962
|
-
const re =
|
|
27003
|
+
const re = memoizedRegExp(
|
|
27004
|
+
rule.matcher,
|
|
27005
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
27006
|
+
);
|
|
26963
27007
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
26964
27008
|
const spans = [];
|
|
26965
27009
|
let m;
|
|
@@ -27067,11 +27111,15 @@ function isCorroborated(candidate, candidates, text) {
|
|
|
27067
27111
|
const labels = req.labels;
|
|
27068
27112
|
if (labels && labels.length > 0) {
|
|
27069
27113
|
const haystack = text.slice(Math.max(0, winStart), winEnd);
|
|
27070
|
-
for (const
|
|
27071
|
-
|
|
27072
|
-
|
|
27073
|
-
|
|
27074
|
-
|
|
27114
|
+
for (const re of memoizedRegExpList(
|
|
27115
|
+
"label",
|
|
27116
|
+
req,
|
|
27117
|
+
() => labels.map((label) => {
|
|
27118
|
+
const trimmed = label.trim();
|
|
27119
|
+
return trimmed.length === 0 ? void 0 : new RegExp(`(?<![A-Za-z0-9])${escapeRegExp2(trimmed)}(?![A-Za-z0-9])`, "i");
|
|
27120
|
+
})
|
|
27121
|
+
)) {
|
|
27122
|
+
if (re?.test(haystack)) return true;
|
|
27075
27123
|
}
|
|
27076
27124
|
}
|
|
27077
27125
|
return false;
|
|
@@ -29292,7 +29340,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
29292
29340
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
29293
29341
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
29294
29342
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
29295
|
-
import { basename as basename5, join as join12
|
|
29343
|
+
import { basename as basename5, join as join12 } from "path";
|
|
29296
29344
|
|
|
29297
29345
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
29298
29346
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
package/scripts/onboard.js
CHANGED
|
@@ -26124,6 +26124,40 @@ function escapeRegExp2(value) {
|
|
|
26124
26124
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26125
26125
|
}
|
|
26126
26126
|
|
|
26127
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
26128
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
26129
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
26130
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
26131
|
+
function listCache(kind) {
|
|
26132
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
26133
|
+
}
|
|
26134
|
+
function memoizedRegExp(owner, build) {
|
|
26135
|
+
const cached2 = singles.get(owner);
|
|
26136
|
+
if (cached2 !== void 0) {
|
|
26137
|
+
cached2.lastIndex = 0;
|
|
26138
|
+
return cached2;
|
|
26139
|
+
}
|
|
26140
|
+
const compiled = build();
|
|
26141
|
+
singles.set(owner, compiled);
|
|
26142
|
+
return compiled;
|
|
26143
|
+
}
|
|
26144
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
26145
|
+
const cache = listCache(kind);
|
|
26146
|
+
const cached2 = cache.get(owner);
|
|
26147
|
+
if (cached2 !== void 0) {
|
|
26148
|
+
if (cached2.stateful) {
|
|
26149
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
26150
|
+
}
|
|
26151
|
+
return cached2.entries;
|
|
26152
|
+
}
|
|
26153
|
+
const entries = build();
|
|
26154
|
+
cache.set(owner, {
|
|
26155
|
+
entries,
|
|
26156
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
26157
|
+
});
|
|
26158
|
+
return entries;
|
|
26159
|
+
}
|
|
26160
|
+
|
|
26127
26161
|
// ../../packages/detections/src/matchers/limits.ts
|
|
26128
26162
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
26129
26163
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -26134,10 +26168,17 @@ var KeywordMatcher2 = class {
|
|
|
26134
26168
|
if (rule.matcher.type !== "keyword") return [];
|
|
26135
26169
|
const { keywords, caseSensitive } = rule.matcher;
|
|
26136
26170
|
const spans = [];
|
|
26137
|
-
|
|
26138
|
-
|
|
26171
|
+
const compiled = memoizedRegExpList(
|
|
26172
|
+
"keyword",
|
|
26173
|
+
rule.matcher,
|
|
26174
|
+
() => keywords.map((kw) => {
|
|
26175
|
+
if (kw.length === 0) return void 0;
|
|
26176
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26177
|
+
})
|
|
26178
|
+
);
|
|
26179
|
+
for (const re of compiled) {
|
|
26180
|
+
if (re === void 0) continue;
|
|
26139
26181
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
26140
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26141
26182
|
let m;
|
|
26142
26183
|
while ((m = re.exec(text)) !== null) {
|
|
26143
26184
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -26153,7 +26194,10 @@ var RegexMatcher2 = class {
|
|
|
26153
26194
|
match(text, rule) {
|
|
26154
26195
|
if (rule.matcher.type !== "regex") return [];
|
|
26155
26196
|
const { pattern, flags: flags2, captureGroup } = rule.matcher;
|
|
26156
|
-
const re =
|
|
26197
|
+
const re = memoizedRegExp(
|
|
26198
|
+
rule.matcher,
|
|
26199
|
+
() => new RegExp(pattern, flags2.includes("d") ? flags2 : `${flags2}d`)
|
|
26200
|
+
);
|
|
26157
26201
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
26158
26202
|
const spans = [];
|
|
26159
26203
|
let m;
|
|
@@ -26296,7 +26340,7 @@ function applyCategoryPosture(posture, repo, mode = "fill-gaps") {
|
|
|
26296
26340
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
26297
26341
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
26298
26342
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
26299
|
-
import { basename as basename5, join as join12
|
|
26343
|
+
import { basename as basename5, join as join12 } from "path";
|
|
26300
26344
|
|
|
26301
26345
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
26302
26346
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
package/scripts/post-tool-use.js
CHANGED
|
@@ -26958,6 +26958,40 @@ function escapeRegExp2(value) {
|
|
|
26958
26958
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26959
26959
|
}
|
|
26960
26960
|
|
|
26961
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
26962
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
26963
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
26964
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
26965
|
+
function listCache(kind) {
|
|
26966
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
26967
|
+
}
|
|
26968
|
+
function memoizedRegExp(owner, build) {
|
|
26969
|
+
const cached2 = singles.get(owner);
|
|
26970
|
+
if (cached2 !== void 0) {
|
|
26971
|
+
cached2.lastIndex = 0;
|
|
26972
|
+
return cached2;
|
|
26973
|
+
}
|
|
26974
|
+
const compiled = build();
|
|
26975
|
+
singles.set(owner, compiled);
|
|
26976
|
+
return compiled;
|
|
26977
|
+
}
|
|
26978
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
26979
|
+
const cache = listCache(kind);
|
|
26980
|
+
const cached2 = cache.get(owner);
|
|
26981
|
+
if (cached2 !== void 0) {
|
|
26982
|
+
if (cached2.stateful) {
|
|
26983
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
26984
|
+
}
|
|
26985
|
+
return cached2.entries;
|
|
26986
|
+
}
|
|
26987
|
+
const entries = build();
|
|
26988
|
+
cache.set(owner, {
|
|
26989
|
+
entries,
|
|
26990
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
26991
|
+
});
|
|
26992
|
+
return entries;
|
|
26993
|
+
}
|
|
26994
|
+
|
|
26961
26995
|
// ../../packages/detections/src/matchers/limits.ts
|
|
26962
26996
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
26963
26997
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -26968,10 +27002,17 @@ var KeywordMatcher2 = class {
|
|
|
26968
27002
|
if (rule.matcher.type !== "keyword") return [];
|
|
26969
27003
|
const { keywords, caseSensitive } = rule.matcher;
|
|
26970
27004
|
const spans = [];
|
|
26971
|
-
|
|
26972
|
-
|
|
27005
|
+
const compiled = memoizedRegExpList(
|
|
27006
|
+
"keyword",
|
|
27007
|
+
rule.matcher,
|
|
27008
|
+
() => keywords.map((kw) => {
|
|
27009
|
+
if (kw.length === 0) return void 0;
|
|
27010
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
27011
|
+
})
|
|
27012
|
+
);
|
|
27013
|
+
for (const re of compiled) {
|
|
27014
|
+
if (re === void 0) continue;
|
|
26973
27015
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
26974
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26975
27016
|
let m;
|
|
26976
27017
|
while ((m = re.exec(text)) !== null) {
|
|
26977
27018
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -26987,7 +27028,10 @@ var RegexMatcher2 = class {
|
|
|
26987
27028
|
match(text, rule) {
|
|
26988
27029
|
if (rule.matcher.type !== "regex") return [];
|
|
26989
27030
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
26990
|
-
const re =
|
|
27031
|
+
const re = memoizedRegExp(
|
|
27032
|
+
rule.matcher,
|
|
27033
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
27034
|
+
);
|
|
26991
27035
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
26992
27036
|
const spans = [];
|
|
26993
27037
|
let m;
|
|
@@ -27095,11 +27139,15 @@ function isCorroborated(candidate, candidates, text) {
|
|
|
27095
27139
|
const labels = req.labels;
|
|
27096
27140
|
if (labels && labels.length > 0) {
|
|
27097
27141
|
const haystack = text.slice(Math.max(0, winStart), winEnd);
|
|
27098
|
-
for (const
|
|
27099
|
-
|
|
27100
|
-
|
|
27101
|
-
|
|
27102
|
-
|
|
27142
|
+
for (const re of memoizedRegExpList(
|
|
27143
|
+
"label",
|
|
27144
|
+
req,
|
|
27145
|
+
() => labels.map((label) => {
|
|
27146
|
+
const trimmed = label.trim();
|
|
27147
|
+
return trimmed.length === 0 ? void 0 : new RegExp(`(?<![A-Za-z0-9])${escapeRegExp2(trimmed)}(?![A-Za-z0-9])`, "i");
|
|
27148
|
+
})
|
|
27149
|
+
)) {
|
|
27150
|
+
if (re?.test(haystack)) return true;
|
|
27103
27151
|
}
|
|
27104
27152
|
}
|
|
27105
27153
|
return false;
|
|
@@ -27367,13 +27415,14 @@ function probesFor(rule) {
|
|
|
27367
27415
|
const derived = rule.matcher.type === "regex" ? derivedProbes(rule.matcher.pattern) : [];
|
|
27368
27416
|
return [...derived, ...EXPONENTIAL_PROBES, ...POLYNOMIAL_PROBES];
|
|
27369
27417
|
}
|
|
27370
|
-
|
|
27418
|
+
var wallClock = () => performance.now();
|
|
27419
|
+
function worstProbeMs(rule, now = wallClock) {
|
|
27371
27420
|
let ms = 0;
|
|
27372
27421
|
let probe = "";
|
|
27373
27422
|
for (const text of probesFor(rule)) {
|
|
27374
|
-
const start =
|
|
27423
|
+
const start = now();
|
|
27375
27424
|
scan(text, [rule]);
|
|
27376
|
-
const elapsed =
|
|
27425
|
+
const elapsed = now() - start;
|
|
27377
27426
|
if (elapsed > ms) {
|
|
27378
27427
|
ms = elapsed;
|
|
27379
27428
|
probe = text;
|
|
@@ -29994,7 +30043,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
29994
30043
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
29995
30044
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
29996
30045
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
29997
|
-
import { basename as basename5, join as join12
|
|
30046
|
+
import { basename as basename5, join as join12 } from "path";
|
|
29998
30047
|
|
|
29999
30048
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
30000
30049
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
package/scripts/pre-tool-use.js
CHANGED
|
@@ -26958,6 +26958,40 @@ function escapeRegExp2(value) {
|
|
|
26958
26958
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26959
26959
|
}
|
|
26960
26960
|
|
|
26961
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
26962
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
26963
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
26964
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
26965
|
+
function listCache(kind) {
|
|
26966
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
26967
|
+
}
|
|
26968
|
+
function memoizedRegExp(owner, build) {
|
|
26969
|
+
const cached2 = singles.get(owner);
|
|
26970
|
+
if (cached2 !== void 0) {
|
|
26971
|
+
cached2.lastIndex = 0;
|
|
26972
|
+
return cached2;
|
|
26973
|
+
}
|
|
26974
|
+
const compiled = build();
|
|
26975
|
+
singles.set(owner, compiled);
|
|
26976
|
+
return compiled;
|
|
26977
|
+
}
|
|
26978
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
26979
|
+
const cache = listCache(kind);
|
|
26980
|
+
const cached2 = cache.get(owner);
|
|
26981
|
+
if (cached2 !== void 0) {
|
|
26982
|
+
if (cached2.stateful) {
|
|
26983
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
26984
|
+
}
|
|
26985
|
+
return cached2.entries;
|
|
26986
|
+
}
|
|
26987
|
+
const entries = build();
|
|
26988
|
+
cache.set(owner, {
|
|
26989
|
+
entries,
|
|
26990
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
26991
|
+
});
|
|
26992
|
+
return entries;
|
|
26993
|
+
}
|
|
26994
|
+
|
|
26961
26995
|
// ../../packages/detections/src/matchers/limits.ts
|
|
26962
26996
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
26963
26997
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -26968,10 +27002,17 @@ var KeywordMatcher2 = class {
|
|
|
26968
27002
|
if (rule.matcher.type !== "keyword") return [];
|
|
26969
27003
|
const { keywords, caseSensitive } = rule.matcher;
|
|
26970
27004
|
const spans = [];
|
|
26971
|
-
|
|
26972
|
-
|
|
27005
|
+
const compiled = memoizedRegExpList(
|
|
27006
|
+
"keyword",
|
|
27007
|
+
rule.matcher,
|
|
27008
|
+
() => keywords.map((kw) => {
|
|
27009
|
+
if (kw.length === 0) return void 0;
|
|
27010
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
27011
|
+
})
|
|
27012
|
+
);
|
|
27013
|
+
for (const re of compiled) {
|
|
27014
|
+
if (re === void 0) continue;
|
|
26973
27015
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
26974
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26975
27016
|
let m;
|
|
26976
27017
|
while ((m = re.exec(text)) !== null) {
|
|
26977
27018
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -26987,7 +27028,10 @@ var RegexMatcher2 = class {
|
|
|
26987
27028
|
match(text, rule) {
|
|
26988
27029
|
if (rule.matcher.type !== "regex") return [];
|
|
26989
27030
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
26990
|
-
const re =
|
|
27031
|
+
const re = memoizedRegExp(
|
|
27032
|
+
rule.matcher,
|
|
27033
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
27034
|
+
);
|
|
26991
27035
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
26992
27036
|
const spans = [];
|
|
26993
27037
|
let m;
|
|
@@ -27095,11 +27139,15 @@ function isCorroborated(candidate, candidates, text) {
|
|
|
27095
27139
|
const labels = req.labels;
|
|
27096
27140
|
if (labels && labels.length > 0) {
|
|
27097
27141
|
const haystack = text.slice(Math.max(0, winStart), winEnd);
|
|
27098
|
-
for (const
|
|
27099
|
-
|
|
27100
|
-
|
|
27101
|
-
|
|
27102
|
-
|
|
27142
|
+
for (const re of memoizedRegExpList(
|
|
27143
|
+
"label",
|
|
27144
|
+
req,
|
|
27145
|
+
() => labels.map((label) => {
|
|
27146
|
+
const trimmed = label.trim();
|
|
27147
|
+
return trimmed.length === 0 ? void 0 : new RegExp(`(?<![A-Za-z0-9])${escapeRegExp2(trimmed)}(?![A-Za-z0-9])`, "i");
|
|
27148
|
+
})
|
|
27149
|
+
)) {
|
|
27150
|
+
if (re?.test(haystack)) return true;
|
|
27103
27151
|
}
|
|
27104
27152
|
}
|
|
27105
27153
|
return false;
|
|
@@ -27367,13 +27415,14 @@ function probesFor(rule) {
|
|
|
27367
27415
|
const derived = rule.matcher.type === "regex" ? derivedProbes(rule.matcher.pattern) : [];
|
|
27368
27416
|
return [...derived, ...EXPONENTIAL_PROBES, ...POLYNOMIAL_PROBES];
|
|
27369
27417
|
}
|
|
27370
|
-
|
|
27418
|
+
var wallClock = () => performance.now();
|
|
27419
|
+
function worstProbeMs(rule, now = wallClock) {
|
|
27371
27420
|
let ms = 0;
|
|
27372
27421
|
let probe = "";
|
|
27373
27422
|
for (const text of probesFor(rule)) {
|
|
27374
|
-
const start =
|
|
27423
|
+
const start = now();
|
|
27375
27424
|
scan(text, [rule]);
|
|
27376
|
-
const elapsed =
|
|
27425
|
+
const elapsed = now() - start;
|
|
27377
27426
|
if (elapsed > ms) {
|
|
27378
27427
|
ms = elapsed;
|
|
27379
27428
|
probe = text;
|
|
@@ -29991,7 +30040,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
29991
30040
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
29992
30041
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
29993
30042
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
29994
|
-
import { basename as basename5, join as join12
|
|
30043
|
+
import { basename as basename5, join as join12 } from "path";
|
|
29995
30044
|
|
|
29996
30045
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
29997
30046
|
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) {
|
|
@@ -28778,14 +28822,14 @@ function renderStatusBar(s, opts = {}) {
|
|
|
28778
28822
|
const unreviewed = `unreviewed ${SHADE.full}${String(u.critical)} ${SHADE.dark}${String(u.high)} ${SHADE.medium}${String(u.medium)} ${SHADE.light}${String(u.low)}`;
|
|
28779
28823
|
return `\u25B8\u25B8 AKA health ${String(s.score)}/100 ${unreviewed} \u2691 ${String(s.openFindings)} open findings`;
|
|
28780
28824
|
}
|
|
28781
|
-
const
|
|
28825
|
+
const sep4 = ` ${paint.dim("\u2502")} `;
|
|
28782
28826
|
const sq = "\u25A0";
|
|
28783
28827
|
const dot = s.score >= 80 ? paint.ok("\u25CF") : s.score >= 50 ? paint.high("\u25CF") : paint.critical("\u25CF");
|
|
28784
28828
|
const score = `${dot} health ${paint.bold(String(s.score))}${paint.dim("/100")}`;
|
|
28785
28829
|
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)}`;
|
|
28786
28830
|
const flag = s.openFindings > 0 ? paint.critical("\u2691") : paint.dim("\u2691");
|
|
28787
28831
|
const open2 = `${flag} ${String(s.openFindings)} open findings`;
|
|
28788
|
-
return `${paint.brand("\u25B8\u25B8 AKA")}${
|
|
28832
|
+
return `${paint.brand("\u25B8\u25B8 AKA")}${sep4}${score}${sep4}${tally}${sep4}${open2}`;
|
|
28789
28833
|
}
|
|
28790
28834
|
function findingStatus(summary) {
|
|
28791
28835
|
return {
|