xploitscan-shared-rules 1.25.2 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +43 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -505,7 +505,7 @@ declare function routeForFile(table: RouteTable, filePath: string): AppRoute | u
|
|
|
505
505
|
* contradicts the sentence. That is a join, not an analysis.
|
|
506
506
|
*/
|
|
507
507
|
|
|
508
|
-
type IntentOrigin = "declared" | "agent-instructions" | "readme";
|
|
508
|
+
type IntentOrigin = "declared" | "prompt-history" | "agent-instructions" | "readme";
|
|
509
509
|
interface IntentStatement {
|
|
510
510
|
/** The sentence, trimmed of markdown noise. */
|
|
511
511
|
text: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -505,7 +505,7 @@ declare function routeForFile(table: RouteTable, filePath: string): AppRoute | u
|
|
|
505
505
|
* contradicts the sentence. That is a join, not an analysis.
|
|
506
506
|
*/
|
|
507
507
|
|
|
508
|
-
type IntentOrigin = "declared" | "agent-instructions" | "readme";
|
|
508
|
+
type IntentOrigin = "declared" | "prompt-history" | "agent-instructions" | "readme";
|
|
509
509
|
interface IntentStatement {
|
|
510
510
|
/** The sentence, trimmed of markdown noise. */
|
|
511
511
|
text: string;
|
package/dist/index.js
CHANGED
|
@@ -527,11 +527,43 @@ function routeForFile(table, filePath) {
|
|
|
527
527
|
// src/intent.ts
|
|
528
528
|
var INTENT_SOURCES = [
|
|
529
529
|
{ test: /(^|\/)\.xploitscan-intent$/i, origin: "declared" },
|
|
530
|
+
// The CLI's --intent flag, passed as a synthetic file so it travels the
|
|
531
|
+
// same path as a real spec. Named for what it is, so a finding reports
|
|
532
|
+
// '--intent says ...' rather than claiming a file exists that does not.
|
|
533
|
+
{ test: /^--intent$/, origin: "declared" },
|
|
534
|
+
// The prompt itself, where a tool preserves it. This is the purest signal
|
|
535
|
+
// there is — it is what the person actually asked for, before anything was
|
|
536
|
+
// generated — and it is the reason this feature can work at all for people
|
|
537
|
+
// who never wrote a README.
|
|
538
|
+
{ test: /(^|\/)\.specstory\/history\/[^/]+\.md$/i, origin: "prompt-history" },
|
|
539
|
+
{ test: /(^|\/)\.bolt\/prompt$/i, origin: "prompt-history" },
|
|
530
540
|
{ test: /(^|\/)(CLAUDE|AGENTS)\.md$/i, origin: "agent-instructions" },
|
|
531
541
|
{ test: /(^|\/)\.cursorrules$/i, origin: "agent-instructions" },
|
|
542
|
+
{ test: /(^|\/)\.windsurfrules$/i, origin: "agent-instructions" },
|
|
532
543
|
{ test: /(^|\/)\.cursor\/rules\/[^/]+\.mdc$/i, origin: "agent-instructions" },
|
|
544
|
+
// 148,992 public repositories carry this file — more than any source here
|
|
545
|
+
// except .cursor/rules, and it is the same kind of document as CLAUDE.md.
|
|
546
|
+
{ test: /(^|\/)\.github\/copilot-instructions\.md$/i, origin: "agent-instructions" },
|
|
533
547
|
{ test: /(^|\/)README(\.md)?$/i, origin: "readme" }
|
|
534
548
|
];
|
|
549
|
+
function extractUserTurns(content) {
|
|
550
|
+
const out = [];
|
|
551
|
+
const lines = content.split("\n");
|
|
552
|
+
let capturing = false;
|
|
553
|
+
for (let i = 0; i < lines.length; i++) {
|
|
554
|
+
const t = lines[i].trim();
|
|
555
|
+
if (/^_\*\*User\*\*_/.test(t)) {
|
|
556
|
+
capturing = true;
|
|
557
|
+
continue;
|
|
558
|
+
}
|
|
559
|
+
if (/^_\*\*(Assistant|Agent|System)[^_]*_/.test(t) || t === "---") {
|
|
560
|
+
capturing = false;
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
if (capturing && t) out.push({ text: t, line: i + 1 });
|
|
564
|
+
}
|
|
565
|
+
return out;
|
|
566
|
+
}
|
|
535
567
|
function isProse(line) {
|
|
536
568
|
const t = line.trim();
|
|
537
569
|
if (t.length < 15 || t.length > 400) return false;
|
|
@@ -549,6 +581,17 @@ function harvestIntent(files) {
|
|
|
549
581
|
for (const file of files) {
|
|
550
582
|
const match = INTENT_SOURCES.find((s) => s.test.test(file.path));
|
|
551
583
|
if (!match) continue;
|
|
584
|
+
if (match.origin === "prompt-history" && /\.specstory\//i.test(file.path)) {
|
|
585
|
+
for (const turn of extractUserTurns(file.content)) {
|
|
586
|
+
for (const sentence of turn.text.split(/(?<=[.!?])\s+(?=[A-Z])/)) {
|
|
587
|
+
const text = clean(sentence).trim();
|
|
588
|
+
if (text.length >= 15) {
|
|
589
|
+
out.push({ text, source: file.path, line: turn.line, origin: match.origin });
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
552
595
|
let inFence = false;
|
|
553
596
|
const lines = file.content.split("\n");
|
|
554
597
|
for (let i = 0; i < lines.length; i++) {
|