cursordoctrine 0.2.1 → 0.2.2
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.
|
@@ -159,6 +159,9 @@ try:
|
|
|
159
159
|
q = m.group(1).strip()
|
|
160
160
|
if len(q) > 2000:
|
|
161
161
|
q = q[:2000] + "..."
|
|
162
|
+
q = re.sub(r"\bnpm_[A-Za-z0-9]{10,}\b", "[REDACTED_NPM_TOKEN]", q)
|
|
163
|
+
q = re.sub(r"\b(sk-[A-Za-z0-9]{10,}|ghp_[A-Za-z0-9]{20,}|gho_[A-Za-z0-9]{20,})\b", "[REDACTED_TOKEN]", q)
|
|
164
|
+
q = re.sub(r"(?i)(api[_-]?key|token|secret|password)\s*[:=]\s*\S+", r"\1=[REDACTED]", q)
|
|
162
165
|
print(q)
|
|
163
166
|
break
|
|
164
167
|
except Exception:
|
|
@@ -172,6 +175,7 @@ except Exception:
|
|
|
172
175
|
printf '%s' "$reversed" |
|
|
173
176
|
grep -m1 -oE '<user_query>[^<]*</user_query>' 2>/dev/null |
|
|
174
177
|
sed -E 's@</?user_query>@@g' |
|
|
178
|
+
sed -E 's/\bnpm_[A-Za-z0-9]{10,}\b/[REDACTED_NPM_TOKEN]/g' |
|
|
175
179
|
head -c 2000
|
|
176
180
|
}
|
|
177
181
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cursordoctrine",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Thin self-review hooks for Cursor — the model is the auditor. Intent-trace final review (Tier 0), unified 13-item anti-slop checklist, operational slop detection.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"cursordoctrine": "bin/cli.mjs"
|
|
@@ -73,7 +73,17 @@ function Resolve-AgentPath([string]$p) {
|
|
|
73
73
|
return ConvertTo-FwdPath $p
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
#
|
|
76
|
+
# Strip secrets from text before embedding in agent-facing followups. Intent
|
|
77
|
+
# trace must not re-broadcast tokens the user pasted in chat.
|
|
78
|
+
function Redact-SecretsFromIntent([string]$text) {
|
|
79
|
+
if (-not $text) { return $text }
|
|
80
|
+
$text = $text -replace '\bnpm_[A-Za-z0-9]{10,}\b', '[REDACTED_NPM_TOKEN]'
|
|
81
|
+
$text = $text -replace '\b(sk-[A-Za-z0-9]{10,}|ghp_[A-Za-z0-9]{20,}|gho_[A-Za-z0-9]{20,})\b', '[REDACTED_TOKEN]'
|
|
82
|
+
$text = $text -replace '(?i)(api[_-]?key|token|secret|password)\s*[:=]\s*\S+', '$1=[REDACTED]'
|
|
83
|
+
return $text
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
# Extract the last user <user_query> from a Cursor transcript JSONL.
|
|
77
87
|
# transcript is an array of {role, message} records; we walk backward from the
|
|
78
88
|
# end, find the last user turn whose content has a <user_query> tag, and return
|
|
79
89
|
# its text. Returns '' if there is no transcript or no user_query. Capped at
|
|
@@ -108,7 +118,7 @@ function Get-LastUserQuery($obj) {
|
|
|
108
118
|
if ($text -match '(?s)<user_query>\s*(.+?)\s*</user_query>') {
|
|
109
119
|
$q = $Matches[1].Trim()
|
|
110
120
|
if ($q.Length -gt 2000) { $q = $q.Substring(0, 2000) + '...' }
|
|
111
|
-
return $q
|
|
121
|
+
return (Redact-SecretsFromIntent $q)
|
|
112
122
|
}
|
|
113
123
|
}
|
|
114
124
|
return ''
|