@akasecurity/ai-tc-codex 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/.codex-plugin/plugin.json +1 -1
- package/package.json +4 -4
- 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 +62 -13
- 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/session-start.js +86 -32
- package/scripts/start-light.js +52 -8
- package/scripts/stop.js +49 -5
- package/scripts/user-prompt-submit.js +62 -13
- package/skills/setup/SKILL.md +17 -0
package/scripts/remediate.js
CHANGED
|
@@ -26081,6 +26081,40 @@ function escapeRegExp2(value) {
|
|
|
26081
26081
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
26082
26082
|
}
|
|
26083
26083
|
|
|
26084
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
26085
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
26086
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
26087
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
26088
|
+
function listCache(kind) {
|
|
26089
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
26090
|
+
}
|
|
26091
|
+
function memoizedRegExp(owner, build) {
|
|
26092
|
+
const cached2 = singles.get(owner);
|
|
26093
|
+
if (cached2 !== void 0) {
|
|
26094
|
+
cached2.lastIndex = 0;
|
|
26095
|
+
return cached2;
|
|
26096
|
+
}
|
|
26097
|
+
const compiled = build();
|
|
26098
|
+
singles.set(owner, compiled);
|
|
26099
|
+
return compiled;
|
|
26100
|
+
}
|
|
26101
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
26102
|
+
const cache = listCache(kind);
|
|
26103
|
+
const cached2 = cache.get(owner);
|
|
26104
|
+
if (cached2 !== void 0) {
|
|
26105
|
+
if (cached2.stateful) {
|
|
26106
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
26107
|
+
}
|
|
26108
|
+
return cached2.entries;
|
|
26109
|
+
}
|
|
26110
|
+
const entries = build();
|
|
26111
|
+
cache.set(owner, {
|
|
26112
|
+
entries,
|
|
26113
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
26114
|
+
});
|
|
26115
|
+
return entries;
|
|
26116
|
+
}
|
|
26117
|
+
|
|
26084
26118
|
// ../../packages/detections/src/matchers/limits.ts
|
|
26085
26119
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
26086
26120
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -26091,10 +26125,17 @@ var KeywordMatcher2 = class {
|
|
|
26091
26125
|
if (rule.matcher.type !== "keyword") return [];
|
|
26092
26126
|
const { keywords, caseSensitive } = rule.matcher;
|
|
26093
26127
|
const spans = [];
|
|
26094
|
-
|
|
26095
|
-
|
|
26128
|
+
const compiled = memoizedRegExpList(
|
|
26129
|
+
"keyword",
|
|
26130
|
+
rule.matcher,
|
|
26131
|
+
() => keywords.map((kw) => {
|
|
26132
|
+
if (kw.length === 0) return void 0;
|
|
26133
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26134
|
+
})
|
|
26135
|
+
);
|
|
26136
|
+
for (const re of compiled) {
|
|
26137
|
+
if (re === void 0) continue;
|
|
26096
26138
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
26097
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
26098
26139
|
let m;
|
|
26099
26140
|
while ((m = re.exec(text)) !== null) {
|
|
26100
26141
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -26110,7 +26151,10 @@ var RegexMatcher2 = class {
|
|
|
26110
26151
|
match(text, rule) {
|
|
26111
26152
|
if (rule.matcher.type !== "regex") return [];
|
|
26112
26153
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
26113
|
-
const re =
|
|
26154
|
+
const re = memoizedRegExp(
|
|
26155
|
+
rule.matcher,
|
|
26156
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
26157
|
+
);
|
|
26114
26158
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
26115
26159
|
const spans = [];
|
|
26116
26160
|
let m;
|
|
@@ -26218,11 +26262,15 @@ function isCorroborated(candidate, candidates, text) {
|
|
|
26218
26262
|
const labels = req.labels;
|
|
26219
26263
|
if (labels && labels.length > 0) {
|
|
26220
26264
|
const haystack = text.slice(Math.max(0, winStart), winEnd);
|
|
26221
|
-
for (const
|
|
26222
|
-
|
|
26223
|
-
|
|
26224
|
-
|
|
26225
|
-
|
|
26265
|
+
for (const re of memoizedRegExpList(
|
|
26266
|
+
"label",
|
|
26267
|
+
req,
|
|
26268
|
+
() => labels.map((label) => {
|
|
26269
|
+
const trimmed = label.trim();
|
|
26270
|
+
return trimmed.length === 0 ? void 0 : new RegExp(`(?<![A-Za-z0-9])${escapeRegExp2(trimmed)}(?![A-Za-z0-9])`, "i");
|
|
26271
|
+
})
|
|
26272
|
+
)) {
|
|
26273
|
+
if (re?.test(haystack)) return true;
|
|
26226
26274
|
}
|
|
26227
26275
|
}
|
|
26228
26276
|
return false;
|
|
@@ -26490,13 +26538,14 @@ function probesFor(rule) {
|
|
|
26490
26538
|
const derived = rule.matcher.type === "regex" ? derivedProbes(rule.matcher.pattern) : [];
|
|
26491
26539
|
return [...derived, ...EXPONENTIAL_PROBES, ...POLYNOMIAL_PROBES];
|
|
26492
26540
|
}
|
|
26493
|
-
|
|
26541
|
+
var wallClock = () => performance.now();
|
|
26542
|
+
function worstProbeMs(rule, now = wallClock) {
|
|
26494
26543
|
let ms = 0;
|
|
26495
26544
|
let probe = "";
|
|
26496
26545
|
for (const text of probesFor(rule)) {
|
|
26497
|
-
const start =
|
|
26546
|
+
const start = now();
|
|
26498
26547
|
scan(text, [rule]);
|
|
26499
|
-
const elapsed =
|
|
26548
|
+
const elapsed = now() - start;
|
|
26500
26549
|
if (elapsed > ms) {
|
|
26501
26550
|
ms = elapsed;
|
|
26502
26551
|
probe = text;
|
|
@@ -29131,7 +29180,7 @@ function applyCategoryPosture(posture, repo, mode = "fill-gaps") {
|
|
|
29131
29180
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
29132
29181
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
29133
29182
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
29134
|
-
import { basename as basename5, join as join12
|
|
29183
|
+
import { basename as basename5, join as join12 } from "path";
|
|
29135
29184
|
|
|
29136
29185
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
29137
29186
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
@@ -29878,8 +29927,8 @@ function table(headers, rows, opts = {}) {
|
|
|
29878
29927
|
const widths = headers.map(
|
|
29879
29928
|
(h, i) => Math.max(visibleLength(h), ...rows.map((r) => visibleLength(r[i] ?? "")))
|
|
29880
29929
|
);
|
|
29881
|
-
const
|
|
29882
|
-
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(
|
|
29930
|
+
const sep4 = " ".repeat(gap);
|
|
29931
|
+
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(sep4);
|
|
29883
29932
|
const headerLine = fmt(headers.map((h) => h.toUpperCase()));
|
|
29884
29933
|
if (opts.rowSep === true) {
|
|
29885
29934
|
const fullWidth = widths.reduce((n, w) => n + w, 0) + gap * Math.max(0, widths.length - 1);
|
|
@@ -29891,7 +29940,7 @@ function table(headers, rows, opts = {}) {
|
|
|
29891
29940
|
});
|
|
29892
29941
|
return [headerLine, rule, ...body].join("\n");
|
|
29893
29942
|
}
|
|
29894
|
-
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(
|
|
29943
|
+
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(sep4);
|
|
29895
29944
|
return [headerLine, ruleLine, ...rows.map(fmt)].join("\n");
|
|
29896
29945
|
}
|
|
29897
29946
|
function fenced(body) {
|
|
@@ -30311,7 +30360,7 @@ var DAY_MS5 = 24 * 60 * 60 * 1e3;
|
|
|
30311
30360
|
|
|
30312
30361
|
// src/remediation/redact.ts
|
|
30313
30362
|
import { readFileSync as readFileSync12, realpathSync as realpathSync3, renameSync as renameSync5, rmSync as rmSync6, writeFileSync as writeFileSync9 } from "fs";
|
|
30314
|
-
import { isAbsolute as isAbsolute2, relative
|
|
30363
|
+
import { isAbsolute as isAbsolute2, relative, resolve } from "path";
|
|
30315
30364
|
var REDACTED_PLACEHOLDER = "[REDACTED:SECRET]";
|
|
30316
30365
|
function platformRedactionScope(home) {
|
|
30317
30366
|
return { artifactRoots: [transcriptsDir(home)] };
|
|
@@ -30326,7 +30375,7 @@ function realPathOrNull(path) {
|
|
|
30326
30375
|
function isWithinRoot(realTarget, root) {
|
|
30327
30376
|
const realRoot = realPathOrNull(root);
|
|
30328
30377
|
if (realRoot === null) return false;
|
|
30329
|
-
const rel =
|
|
30378
|
+
const rel = relative(realRoot, realTarget);
|
|
30330
30379
|
return rel !== "" && !rel.startsWith("..") && !isAbsolute2(rel);
|
|
30331
30380
|
}
|
|
30332
30381
|
function resolveRedactableArtifact(filePath, scope) {
|
package/scripts/scan-worker.js
CHANGED
|
@@ -579,6 +579,40 @@ function escapeRegExp2(value) {
|
|
|
579
579
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
580
580
|
}
|
|
581
581
|
|
|
582
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
583
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
584
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
585
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
586
|
+
function listCache(kind) {
|
|
587
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
588
|
+
}
|
|
589
|
+
function memoizedRegExp(owner, build) {
|
|
590
|
+
const cached2 = singles.get(owner);
|
|
591
|
+
if (cached2 !== void 0) {
|
|
592
|
+
cached2.lastIndex = 0;
|
|
593
|
+
return cached2;
|
|
594
|
+
}
|
|
595
|
+
const compiled = build();
|
|
596
|
+
singles.set(owner, compiled);
|
|
597
|
+
return compiled;
|
|
598
|
+
}
|
|
599
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
600
|
+
const cache = listCache(kind);
|
|
601
|
+
const cached2 = cache.get(owner);
|
|
602
|
+
if (cached2 !== void 0) {
|
|
603
|
+
if (cached2.stateful) {
|
|
604
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
605
|
+
}
|
|
606
|
+
return cached2.entries;
|
|
607
|
+
}
|
|
608
|
+
const entries = build();
|
|
609
|
+
cache.set(owner, {
|
|
610
|
+
entries,
|
|
611
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
612
|
+
});
|
|
613
|
+
return entries;
|
|
614
|
+
}
|
|
615
|
+
|
|
582
616
|
// ../../packages/detections/src/matchers/limits.ts
|
|
583
617
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
584
618
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -589,10 +623,17 @@ var KeywordMatcher = class {
|
|
|
589
623
|
if (rule.matcher.type !== "keyword") return [];
|
|
590
624
|
const { keywords, caseSensitive } = rule.matcher;
|
|
591
625
|
const spans = [];
|
|
592
|
-
|
|
593
|
-
|
|
626
|
+
const compiled = memoizedRegExpList(
|
|
627
|
+
"keyword",
|
|
628
|
+
rule.matcher,
|
|
629
|
+
() => keywords.map((kw) => {
|
|
630
|
+
if (kw.length === 0) return void 0;
|
|
631
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
632
|
+
})
|
|
633
|
+
);
|
|
634
|
+
for (const re of compiled) {
|
|
635
|
+
if (re === void 0) continue;
|
|
594
636
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
595
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
596
637
|
let m;
|
|
597
638
|
while ((m = re.exec(text)) !== null) {
|
|
598
639
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -608,7 +649,10 @@ var RegexMatcher = class {
|
|
|
608
649
|
match(text, rule) {
|
|
609
650
|
if (rule.matcher.type !== "regex") return [];
|
|
610
651
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
611
|
-
const re =
|
|
652
|
+
const re = memoizedRegExp(
|
|
653
|
+
rule.matcher,
|
|
654
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
655
|
+
);
|
|
612
656
|
const scanText = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
613
657
|
const spans = [];
|
|
614
658
|
let m;
|
|
@@ -713,11 +757,15 @@ function isCorroborated(candidate, candidates, text) {
|
|
|
713
757
|
const labels = req.labels;
|
|
714
758
|
if (labels && labels.length > 0) {
|
|
715
759
|
const haystack = text.slice(Math.max(0, winStart), winEnd);
|
|
716
|
-
for (const
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
760
|
+
for (const re of memoizedRegExpList(
|
|
761
|
+
"label",
|
|
762
|
+
req,
|
|
763
|
+
() => labels.map((label) => {
|
|
764
|
+
const trimmed = label.trim();
|
|
765
|
+
return trimmed.length === 0 ? void 0 : new RegExp(`(?<![A-Za-z0-9])${escapeRegExp2(trimmed)}(?![A-Za-z0-9])`, "i");
|
|
766
|
+
})
|
|
767
|
+
)) {
|
|
768
|
+
if (re?.test(haystack)) return true;
|
|
721
769
|
}
|
|
722
770
|
}
|
|
723
771
|
return false;
|
|
@@ -17951,13 +17999,14 @@ function probesFor(rule) {
|
|
|
17951
17999
|
const derived = rule.matcher.type === "regex" ? derivedProbes(rule.matcher.pattern) : [];
|
|
17952
18000
|
return [...derived, ...EXPONENTIAL_PROBES, ...POLYNOMIAL_PROBES];
|
|
17953
18001
|
}
|
|
17954
|
-
|
|
18002
|
+
var wallClock = () => performance.now();
|
|
18003
|
+
function worstProbeMs(rule, now = wallClock) {
|
|
17955
18004
|
let ms = 0;
|
|
17956
18005
|
let probe = "";
|
|
17957
18006
|
for (const text of probesFor(rule)) {
|
|
17958
|
-
const start =
|
|
18007
|
+
const start = now();
|
|
17959
18008
|
scan(text, [rule]);
|
|
17960
|
-
const elapsed =
|
|
18009
|
+
const elapsed = now() - start;
|
|
17961
18010
|
if (elapsed > ms) {
|
|
17962
18011
|
ms = elapsed;
|
|
17963
18012
|
probe = text;
|
package/scripts/session-start.js
CHANGED
|
@@ -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/start-light.js
CHANGED
|
@@ -18255,6 +18255,40 @@ function escapeRegExp2(value) {
|
|
|
18255
18255
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
18256
18256
|
}
|
|
18257
18257
|
|
|
18258
|
+
// ../../packages/detections/src/regex-cache.ts
|
|
18259
|
+
var singles = /* @__PURE__ */ new WeakMap();
|
|
18260
|
+
var keywordLists = /* @__PURE__ */ new WeakMap();
|
|
18261
|
+
var labelLists = /* @__PURE__ */ new WeakMap();
|
|
18262
|
+
function listCache(kind) {
|
|
18263
|
+
return kind === "keyword" ? keywordLists : labelLists;
|
|
18264
|
+
}
|
|
18265
|
+
function memoizedRegExp(owner, build) {
|
|
18266
|
+
const cached2 = singles.get(owner);
|
|
18267
|
+
if (cached2 !== void 0) {
|
|
18268
|
+
cached2.lastIndex = 0;
|
|
18269
|
+
return cached2;
|
|
18270
|
+
}
|
|
18271
|
+
const compiled = build();
|
|
18272
|
+
singles.set(owner, compiled);
|
|
18273
|
+
return compiled;
|
|
18274
|
+
}
|
|
18275
|
+
function memoizedRegExpList(kind, owner, build) {
|
|
18276
|
+
const cache = listCache(kind);
|
|
18277
|
+
const cached2 = cache.get(owner);
|
|
18278
|
+
if (cached2 !== void 0) {
|
|
18279
|
+
if (cached2.stateful) {
|
|
18280
|
+
for (const re of cached2.entries) if (re !== void 0) re.lastIndex = 0;
|
|
18281
|
+
}
|
|
18282
|
+
return cached2.entries;
|
|
18283
|
+
}
|
|
18284
|
+
const entries = build();
|
|
18285
|
+
cache.set(owner, {
|
|
18286
|
+
entries,
|
|
18287
|
+
stateful: entries.some((re) => re !== void 0 && (re.global || re.sticky))
|
|
18288
|
+
});
|
|
18289
|
+
return entries;
|
|
18290
|
+
}
|
|
18291
|
+
|
|
18258
18292
|
// ../../packages/detections/src/matchers/limits.ts
|
|
18259
18293
|
var MAX_MATCHES_PER_RULE = 1e4;
|
|
18260
18294
|
var MAX_REGEX_INPUT_LENGTH = 2e5;
|
|
@@ -18265,10 +18299,17 @@ var KeywordMatcher2 = class {
|
|
|
18265
18299
|
if (rule.matcher.type !== "keyword") return [];
|
|
18266
18300
|
const { keywords, caseSensitive } = rule.matcher;
|
|
18267
18301
|
const spans = [];
|
|
18268
|
-
|
|
18269
|
-
|
|
18302
|
+
const compiled = memoizedRegExpList(
|
|
18303
|
+
"keyword",
|
|
18304
|
+
rule.matcher,
|
|
18305
|
+
() => keywords.map((kw) => {
|
|
18306
|
+
if (kw.length === 0) return void 0;
|
|
18307
|
+
return new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
18308
|
+
})
|
|
18309
|
+
);
|
|
18310
|
+
for (const re of compiled) {
|
|
18311
|
+
if (re === void 0) continue;
|
|
18270
18312
|
if (spans.length >= MAX_MATCHES_PER_RULE) break;
|
|
18271
|
-
const re = new RegExp(escapeRegExp2(kw), caseSensitive ? "gu" : "giu");
|
|
18272
18313
|
let m;
|
|
18273
18314
|
while ((m = re.exec(text)) !== null) {
|
|
18274
18315
|
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
@@ -18284,7 +18325,10 @@ var RegexMatcher2 = class {
|
|
|
18284
18325
|
match(text, rule) {
|
|
18285
18326
|
if (rule.matcher.type !== "regex") return [];
|
|
18286
18327
|
const { pattern, flags, captureGroup } = rule.matcher;
|
|
18287
|
-
const re =
|
|
18328
|
+
const re = memoizedRegExp(
|
|
18329
|
+
rule.matcher,
|
|
18330
|
+
() => new RegExp(pattern, flags.includes("d") ? flags : `${flags}d`)
|
|
18331
|
+
);
|
|
18288
18332
|
const scanText2 = text.length > MAX_REGEX_INPUT_LENGTH ? text.slice(0, MAX_REGEX_INPUT_LENGTH) : text;
|
|
18289
18333
|
const spans = [];
|
|
18290
18334
|
let m;
|
|
@@ -18417,7 +18461,7 @@ import { basename as basename4, dirname as dirname3, sep as sep3 } from "path";
|
|
|
18417
18461
|
// ../../packages/plugin-sdk/src/project-files.ts
|
|
18418
18462
|
var import_ignore = __toESM(require_ignore(), 1);
|
|
18419
18463
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "fs";
|
|
18420
|
-
import { basename as basename5, join as join12
|
|
18464
|
+
import { basename as basename5, join as join12 } from "path";
|
|
18421
18465
|
|
|
18422
18466
|
// ../../packages/plugin-sdk/src/provider-env-antigravity.ts
|
|
18423
18467
|
var optionalBaseUrl2 = external_exports.preprocess((v) => {
|
|
@@ -18615,8 +18659,8 @@ function table(headers, rows, opts = {}) {
|
|
|
18615
18659
|
const widths = headers.map(
|
|
18616
18660
|
(h, i) => Math.max(visibleLength(h), ...rows.map((r) => visibleLength(r[i] ?? "")))
|
|
18617
18661
|
);
|
|
18618
|
-
const
|
|
18619
|
-
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(
|
|
18662
|
+
const sep4 = " ".repeat(gap);
|
|
18663
|
+
const fmt = (cells) => cells.map((cell, i) => padEnd(cell, widths[i] ?? 0)).join(sep4);
|
|
18620
18664
|
const headerLine = fmt(headers.map((h) => h.toUpperCase()));
|
|
18621
18665
|
if (opts.rowSep === true) {
|
|
18622
18666
|
const fullWidth = widths.reduce((n, w) => n + w, 0) + gap * Math.max(0, widths.length - 1);
|
|
@@ -18628,7 +18672,7 @@ function table(headers, rows, opts = {}) {
|
|
|
18628
18672
|
});
|
|
18629
18673
|
return [headerLine, rule, ...body].join("\n");
|
|
18630
18674
|
}
|
|
18631
|
-
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(
|
|
18675
|
+
const ruleLine = widths.map((w) => "\u2500".repeat(w)).join(sep4);
|
|
18632
18676
|
return [headerLine, ruleLine, ...rows.map(fmt)].join("\n");
|
|
18633
18677
|
}
|
|
18634
18678
|
function fenced(body) {
|
package/scripts/stop.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) => {
|