@nodatachat/mcp 1.3.1 → 1.3.8
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/README.md +61 -1
- package/dist/gate.js +18 -0
- package/dist/index.js +133 -74
- package/dist/status.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -108,8 +108,9 @@ Any mode except agent mode, **no account needed**, entirely on your machine. Any
|
|
|
108
108
|
| Say | Tool | What happens |
|
|
109
109
|
|-----|------|--------------|
|
|
110
110
|
| "scan this folder" | `nodata_scan_folder` | The **whole** result — counts by type, folder and file — plus a full content‑free HTML report in `~/.nodata/reports` (every finding, never a value). |
|
|
111
|
+
| "what should I do with these?" | `nodata_plan` | A **recommended policy** per file after the scan: tier (Restricted / Confidential / Internal) and action (clean copy + lock, lock, clean copy, keep); credentials also get "rotate at the source". Nothing happens until you approve, and you can change any line first. Proposing is not accepting. |
|
|
111
112
|
| "lock what it found" | `nodata_protect` | Seals the files with findings to this device's key as `<file>.ndc` — the same v3 seal and format as `nodata protect`, so `nodata open` opens it too. Local receipt with hashes. |
|
|
112
|
-
| "clean copy of this file" | `nodata_redact` | A copy with every detected value replaced by `[CARD]`, `[ID]`, `[IBAN]`, `[PHONE]`, `[EMAIL]
|
|
113
|
+
| "clean copy of this file" | `nodata_redact` | A copy with every detected value replaced by `[CARD]`, `[ID]`, `[IBAN]`, `[PHONE]`, `[EMAIL]`; a personal‑data column (CSV or Excel) is replaced with one stable token per person (`[NAME-1]` …) and amounts stay whole. Excel stays Excel. Same detectors as the scan. |
|
|
113
114
|
| "open this .ndc" | `nodata_open` | Opens it back next to itself, hash‑checked. |
|
|
114
115
|
| "who can read what?" | `nodata_policy` | The policy board (admin): every agent and its exact reach. Change it with `nodata_grant` (preview → approve, a copy of the approval kept in `~/.nodata/approvals`) or `nodata_revoke` (immediate). |
|
|
115
116
|
|
|
@@ -126,6 +127,65 @@ The one-sentence version: **encrypt locally, send, revoke later, prove what happ
|
|
|
126
127
|
|
|
127
128
|
---
|
|
128
129
|
|
|
130
|
+
## Terms, agents and the status line
|
|
131
|
+
|
|
132
|
+
- **Terms in the terminal.** The data tools wait until the current terms are accepted:
|
|
133
|
+
`nodata_terms` shows them (section 7 covers AI agents: NoData answers for what passes through its
|
|
134
|
+
tools, not for programs an agent writes or files it reaches on its own), and `confirm: true`
|
|
135
|
+
accepts. The acceptance is kept in `~/.nodata/consent.json` and recorded at NoData against your
|
|
136
|
+
organisation, key and agent — and copied to your organisation's proof vault. Operational
|
|
137
|
+
identification only: organisation, agent, version, time, hash. No content.
|
|
138
|
+
- **Every agent has a name and a colour** — `claude-code@your-laptop`, 🟣 — in every tool result, so
|
|
139
|
+
several agents stay apart.
|
|
140
|
+
- **The status line** (installed with the read gate): `● NoData` at the bottom of Claude Code —
|
|
141
|
+
green = guarded, yellow = gate off, red = terms not accepted. No segment = not guarded. A status
|
|
142
|
+
line you already had keeps running beside it, and comes back on `uninstall-gate`.
|
|
143
|
+
|
|
144
|
+
## This machine as a Capsule node
|
|
145
|
+
|
|
146
|
+
`nodata_node` registers the machine as a node of your organisation's Capsule fleet, after you approve it once. It uses the same enrolment and signed heartbeat as the installed Capsule agent.
|
|
147
|
+
|
|
148
|
+
- **Capsule = node:** one per machine.
|
|
149
|
+
- **Agent = workload:** Claude Code, Cursor or a bot running on that node.
|
|
150
|
+
- **Billing = decisions:** a node is not a billing unit.
|
|
151
|
+
|
|
152
|
+
While an agent runs, a heartbeat every 5 minutes reports the host name, the agents' names, whether the read gate is on, and the accepted terms version. It never reports content, and the organisation can see and pause the node. The status line shows `node ✓ 2m` when NoData last verified it.
|
|
153
|
+
|
|
154
|
+
## Run with your secrets — the agent never sees them
|
|
155
|
+
|
|
156
|
+
`nodata_run` runs a command on your machine, such as tests, a migration or a deploy script, with the secrets of your NoData vault project. The secrets are passed as environment variables.
|
|
157
|
+
|
|
158
|
+
- **Memory only.** The secrets are pulled into memory, through the same `/api/secrets/pull` the CLI uses, and every released value leaves a proof at NoData. No `.env` file is written.
|
|
159
|
+
- **Blanked output.** The agent gets the exit code and the output, with every secret value blanked. That includes the base64, hex and URL-encoded forms, and any credential the scanner recognises.
|
|
160
|
+
- **Every command needs your approval, as written.** Claude Code asks you in its own dialog. A client without one gets a preview and a single-use code bound to the exact command.
|
|
161
|
+
|
|
162
|
+
Save the token once, in your terminal. Never paste it into the chat:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
npx @nodatachat/mcp secrets-login --project acme-web # token from Courier → 🔑 סודות → CLI token
|
|
166
|
+
npx @nodatachat/mcp secrets-logout
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**Honest limit:** a command that holds a secret can also leak it, for example by sending it out or printing it in an unknown form. Blanking protects the chat, not a hostile command, and that is why each command is approved as written.
|
|
170
|
+
|
|
171
|
+
## The read gate — a scan before the assistant reads
|
|
172
|
+
|
|
173
|
+
The MCP tools keep values out of the model only when the model uses them; Claude Code can also
|
|
174
|
+
open a file with its own Read, Grep or Bash. One command puts NoData's scanner in front of those:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
npx @nodatachat/mcp install-gate # ask first (default)
|
|
178
|
+
npx @nodatachat/mcp install-gate --block # refuse instead
|
|
179
|
+
npx @nodatachat/mcp uninstall-gate
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Before Claude Code reads a data file (csv, xlsx, docx, pdf, .env …), the gate scans it on this
|
|
183
|
+
machine with the same detectors as `nodata_scan_folder`. Findings → you are asked (or the read is
|
|
184
|
+
refused), with the counts and the safer step: `nodata_redact` for a clean copy, `nodata_protect`
|
|
185
|
+
to lock it. Clean copies, sealed files and source code pass without a question. The gate catches
|
|
186
|
+
a Read, a Grep on a file, and a Bash command that names the file; a program that builds the path
|
|
187
|
+
at run time is not caught — `nodata_protect` (ciphertext at rest) is what makes a file unreadable.
|
|
188
|
+
|
|
129
189
|
## Available tools
|
|
130
190
|
|
|
131
191
|
**Agent mode** (`--grant-token`):
|
package/dist/gate.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*! @nodatachat/mcp 1.3.8 | Copyright 2026 Capsule Ltd. | FSL-1.1-ALv2 | see LICENSE.md */
|
|
2
|
+
import{appendFileSync as ht,copyFileSync as Hn,existsSync as gt,mkdirSync as yt,readFileSync as bt,statSync as ve,writeFileSync as zn}from"node:fs";import{homedir as Se}from"node:os";import{basename as _t,extname as we,isAbsolute as xt,join as ke,resolve as kt}from"node:path";var k={text:[],header:[],secrets:[]};function N(t){for(let e of t.text??[])k.text.some(n=>n.kind===e.kind)||k.text.push(e);t.header&&!k.header.includes(t.header)&&k.header.push(t.header);for(let e of t.secrets??[])k.secrets.some(n=>n.id===e.id)||k.secrets.push(e)}function U(){return k.text}function te(){return k.header}var ne=[{id:"aws-access-key",name:"AWS Access Key",pattern:/(?:^|[^A-Z0-9])AKIA[A-Z2-7]{16}(?:[^A-Z2-7]|$)/,severity:"critical"},{id:"aws-secret-key",name:"AWS Secret Key",pattern:/(?:aws_secret_access_key|aws_secret_key|secret_access_key)\s*[=:]\s*['"]?[A-Za-z0-9/+=]{40}['"]?/,severity:"critical"},{id:"gcp-api-key",name:"GCP API Key",pattern:/AIza[0-9A-Za-z_-]{35}/,severity:"critical"},{id:"gcp-service-account",name:"GCP Service Account",pattern:/"type"\s*:\s*"service_account"/,severity:"critical"},{id:"github-token",name:"GitHub Token",pattern:/gh[pousr]_[0-9a-zA-Z]{36,}/,severity:"critical"},{id:"github-fine-grained",name:"GitHub Fine-Grained Token",pattern:/github_pat_[0-9a-zA-Z_]{22,}/,severity:"critical"},{id:"gitlab-token",name:"GitLab Token",pattern:/glpat-[0-9a-zA-Z_-]{20,}/,severity:"critical"},{id:"stripe-secret",name:"Stripe Secret Key",pattern:/sk_live_[0-9a-zA-Z]{24,}/,severity:"critical"},{id:"stripe-restricted",name:"Stripe Restricted Key",pattern:/rk_live_[0-9a-zA-Z]{24,}/,severity:"critical"},{id:"slack-token",name:"Slack Token",pattern:/xox[baprs]-[0-9a-zA-Z-]{10,}/,severity:"high"},{id:"slack-webhook",name:"Slack Webhook",pattern:/hooks\.slack\.com\/services\/T[0-9A-Z]{8,}\/B[0-9A-Z]{8,}\/[0-9a-zA-Z]{24}/,severity:"high"},{id:"twilio-api-key",name:"Twilio API Key",pattern:/SK[0-9a-fA-F]{32}/,severity:"high"},{id:"sendgrid-api-key",name:"SendGrid API Key",pattern:/SG\.[0-9a-zA-Z_-]{22}\.[0-9a-zA-Z_-]{43}/,severity:"critical"},{id:"postgres-uri",name:"PostgreSQL Connection String",pattern:/postgres(?:ql)?:\/\/[^\s'"]{10,}/,severity:"critical"},{id:"mongodb-uri",name:"MongoDB Connection String",pattern:/mongodb(?:\+srv)?:\/\/[^\s'"]{10,}/,severity:"critical"},{id:"redis-uri",name:"Redis Connection String",pattern:/redis(?:s)?:\/\/[^\s'"]{10,}/,severity:"high"},{id:"openai-key",name:"OpenAI API Key",pattern:/sk-[0-9a-zA-Z]{20,}T3BlbkFJ[0-9a-zA-Z]{20,}/,severity:"critical"},{id:"anthropic-key",name:"Anthropic API Key",pattern:/sk-ant-[0-9a-zA-Z_-]{40,}/,severity:"critical"},{id:"firebase-key",name:"Firebase API Key",pattern:/AIza[0-9A-Za-z_-]{35}/,severity:"high"},{id:"supabase-key",name:"Supabase Service Key",pattern:/eyJ[0-9a-zA-Z_-]{100,}/,severity:"critical"},{id:"private-key",name:"Private Key",pattern:/-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----/,severity:"critical"},{id:"jwt-secret",name:"JWT/Generic Secret",pattern:/(?:jwt_secret|JWT_SECRET|secret_key|SECRET_KEY|api_secret|API_SECRET)\s*[=:]\s*['"][^'"]{8,}['"]/,severity:"high"},{id:"password-in-code",name:"Password in Code",pattern:/(?:password|passwd|pwd)\s*[=:]\s*['"][^'"]{8,}['"]/,severity:"high"},{id:"bearer-token",name:"Bearer Token in Code",pattern:/['"]Bearer\s+[0-9a-zA-Z._-]{20,}['"]/,severity:"high"}];var Le=[{pattern:/^(full_?name|first_?name|last_?name|spouse_?name|beneficiary_?name)$/i,type:"name",label:"Person name"},{pattern:/^(email|e_?mail|email_?address)$/i,type:"email",label:"Email address"},{pattern:/^(phone|mobile|telephone|phone_?number|cell_?phone)$/i,type:"phone",label:"Phone number"},{pattern:/^(id_?number|identity|ssn|social_?security|national_?id|teudat_?zehut)$/i,type:"id",label:"ID number"},{pattern:/^(address|street_?address|home_?address)$/i,type:"address",label:"Address"},{pattern:/^(date_?of_?birth|dob|birth_?date|birthday)$/i,type:"dob",label:"Date of birth"},{pattern:/^(bank_?account|iban|account_?number|bank_?details|routing_?number)$/i,type:"financial",label:"Bank account"},{pattern:/^(credit_?card|card_?number|cvv|cc_?number)$/i,type:"financial",label:"Credit card"},{pattern:/^(salary|income|commission|premium|compensation)$/i,type:"financial",label:"Salary / income"},{pattern:/^(medical_?info|health_?conditions|diagnosis|medication|prescription)$/i,type:"medical",label:"Medical"},{pattern:/^(passport|passport_?number|passport_?id)$/i,type:"id",label:"Passport"},{pattern:/^(driver_?license|drivers_?license|dl_?number)$/i,type:"id",label:"Driver license"},{pattern:/^(tax_?id|tin|vat_?number|ein)$/i,type:"financial",label:"Tax ID"},{pattern:/^(insurance_?number|policy_?number|member_?id)$/i,type:"id",label:"Insurance/Policy"},{pattern:/^(biometric|fingerprint|face_?id|retina)$/i,type:"biometric",label:"Biometric"},{pattern:/^(latitude|longitude|lat|lng|geo_?location|coordinates)$/i,type:"location",label:"Geolocation"}],De=[{pattern:/^(?:שם|שם_מלא|שם פרטי|שם_פרטי|שם משפחה|שם_משפחה|שם הלקוח|שם בן זוג|שם המבוטח|שם המוטב|שם הילד|שם הקטין)$/i,type:"name",label:"\u05E9\u05DD \u05D0\u05D3\u05DD"},{pattern:/^(?:ת"ז|ת\.ז|ת ז|תז|תעודת זהות|תעודת_זהות|מספר זהות|מס' זהות|teudat_zehut|tz|israeli_id|il_id)$/i,type:"id",label:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA"},{pattern:/^(?:דרכון|מספר דרכון|רישיון נהיגה|רישיון_נהיגה|רשיון נהיגה)$/i,type:"id",label:"\u05D3\u05E8\u05DB\u05D5\u05DF/\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF"},{pattern:/^(?:מייל|דוא"ל|דוא_ל|דואר אלקטרוני|אימייל|כתובת מייל)$/i,type:"email",label:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9"},{pattern:/^(?:טלפון|טל'|נייד|פלאפון|סלולרי|מספר טלפון|טלפון נייד)$/i,type:"phone",label:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF"},{pattern:/^(?:כתובת|כתובת מגורים|רחוב|מס בית|עיר|ישוב|יישוב|מיקוד|כתובת מלאה|מען)$/i,type:"address",label:"\u05DB\u05EA\u05D5\u05D1\u05EA"},{pattern:/^(?:תאריך לידה|ת לידה|תאריך הולדת|יום הולדת|גיל)$/i,type:"dob",label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"},{pattern:/^(?:חשבון בנק|מספר חשבון|מס חשבון|סניף|iban|iban_il)$/i,type:"financial",label:"\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7"},{pattern:/^(?:כרטיס אשראי|מספר אשראי|cvv|אשראי)$/i,type:"financial",label:"\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"},{pattern:/^(?:שכר|משכורת|הכנסה|פרמיה|שכר ברוטו|שכר נטו|תגמול|בונוס|פיצוי)$/i,type:"financial",label:"\u05E9\u05DB\u05E8/\u05D4\u05DB\u05E0\u05E1\u05D4"},{pattern:/^(?:אבחון|אבחנה|מחלה|תרופה|מרשם|בדיקה רפואית|מצב רפואי|חיסון|רגישות|אלרגיה|סוג דם)$/i,type:"medical",label:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9"},{pattern:/^(?:מספר פוליסה|מס פוליסה|פוליסה|מספר חבר|מספר ביטוח)$/i,type:"id",label:"\u05E4\u05D5\u05DC\u05D9\u05E1\u05D4/\u05D7\u05D1\u05E8\u05D5\u05EA"},{pattern:/^(?:שם הילד|תעודת זהות של ילד|ילדים|קטין|מספר ילדים|תעודת לידה)$/i,type:"minor_data",label:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF"},{pattern:/^(?:דת|לאום|מין|נטייה מינית|השקפה פוליטית|מצב משפחתי|עדה|מוצא)$/i,type:"sensitive_personal",label:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9"},{pattern:/^(?:מספר רכב|מס רכב|לוחית רישוי|מספר רישוי)$/i,type:"tracking",label:"\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"}],Fe=/^(id|uuid|created_?at|updated_?at|deleted_?at|status|type|category|description|title|slug|url|path|key|value|enabled|active|public|version|metadata|config|settings|data|content|note|comment|label|color|icon)$/i,He=/^שם[ _](?:ה)?(?:קובץ|מוצר|פריט|חברה|ארגון|עסק|פרויקט|גיליון|טבלה|שדה|קטגוריה|סניף|בנק|עיר|רחוב|ישוב|יישוב|מסמך|תוכנית|חבילה|קורס|מחלקה|אתר|דומיין|מותג|ספק|שירות|תפקיד)$|^(file|product|item|company|org|organization|project|sheet|table|field|category|branch|bank|city|street|document|plan|course|department|site|domain|brand|vendor|service|role)[ _-]?name$/i;function T(t){if(!t)return null;let e=t.trim();if(Fe.test(e)||/^name$/i.test(e))return null;let n=e.replace(/[\s-]+/g,"_");for(let i of[...De,...Le])if(i.pattern.test(e)||i.pattern.test(n))return{type:i.type,label:i.label};if(He.test(e))return null;if(/^שם[ _][\u0590-\u05FF"'׳ ]{2,20}$/.test(e))return{type:"name",label:"\u05E9\u05DD \u05D0\u05D3\u05DD"};if(/^(customer|client|employee|inspector|supervisor|contact|person|patient|user|owner|manager|agent|member|driver|tenant|student|parent|beneficiary|insured)_?(full_?)?name$/i.test(n))return{type:"name",label:"Person name"};for(let i of te()){let r=i(e);if(r)return{type:r.type,label:r.label}}return null}function ie(t){let e=String(t??"").replace(/\D/g,"");if(e.length===0||e.length>9)return!1;let n=e.padStart(9,"0"),i=0;for(let r=0;r<9;r++){let s=parseInt(n[r]??"0",10)*(r%2+1);s>9&&(s-=9),i+=s}return i%10===0&&parseInt(n,10)>0}function ze(t){let e=String(t??"").replace(/\D/g,"");if(e.length<12||e.length>19)return!1;let n=0,i=!1;for(let r=e.length-1;r>=0;r-=1){let s=parseInt(e[r]??"0",10);i&&(s*=2,s>9&&(s-=9)),n+=s,i=!i}return n%10===0}function Ne(t){let e=String(t??"").replace(/\s/g,"").toUpperCase();if(!/^[A-Z]{2}\d{2}[A-Z0-9]{10,30}$/.test(e))return!1;let n=e.slice(4)+e.slice(0,4),i=0;for(let r of n){let s=r>="A"&&r<="Z"?String(r.charCodeAt(0)-55):r;for(let a of s)i=(i*10+Number(a))%97}return i===1}var B="(?<!\\d)(?<!\\d[.,])",O="(?!\\d)(?![.,]\\d)",re=[{subkind:"israeli_id",severity:"high",pattern:new RegExp(`${B}\\d{9}${O}`,"g"),validate:ie,hint:"Israeli national ID (check digit verified) in plaintext. Encrypt the column or mask it at rest."},{subkind:"credit_card",severity:"critical",pattern:new RegExp(`${B}[2-6][ -]?(?:\\d[ -]?){11,17}\\d${O}`,"g"),validate:ze,hint:"Payment card number (Luhn verified) in plaintext. This is PCI scope."},{subkind:"iban",severity:"high",pattern:/\b[A-Z]{2}\d{2}(?: ?[A-Z0-9]{4}){2,7}(?: ?[A-Z0-9]{1,4})?\b/g,validate:Ne,hint:"Bank account in IBAN form (mod-97 verified) in plaintext."},{subkind:"israeli_phone",severity:"medium",pattern:new RegExp(`${B}(?:\\+972[- ]?|0)(?:[57]\\d|[2-489])[- ]?\\d{3}[- ]?\\d{4}${O}`,"g"),validate:t=>{let e=t.replace(/\D/g,"").replace(/^972/,"0");return/^0[57]\d{8}$/.test(e)?!0:/^0[2-489]\d{7}$/.test(e)&&(/[- ]/.test(t)||t.startsWith("+972"))},hint:"Israeli phone number in plaintext."}];function R(t,e){let n=[],i="",r=!1;for(let s=0;s<t.length;s++){let a=t[s];r?a==='"'&&t[s+1]==='"'?(i+='"',s++):a==='"'?r=!1:i+=a:a==='"'?r=!0:a===e?(n.push(i),i=""):i+=a}return n.push(i),n}import{inflateRawSync as Ve}from"node:zlib";import{inflateSync as Ue}from"node:zlib";var j=new Set([".pdf"]),se=8*1024*1024;function Be(t){let e=t.toString("latin1"),n=new Map,i=/(\d+)\s+(\d+)\s+obj\b/g,r;for(;(r=i.exec(e))!==null;){let s=Number(r[1]),a=i.lastIndex,o=e.indexOf("endobj",a);if(o<0)continue;let c=e.indexOf("stream",a),l,p=null;if(c>=0&&c<o){l=e.slice(a,c);let u=c+6;e[u]==="\r"&&(u+=1),e[u]===`
|
|
3
|
+
`&&(u+=1);let f=e.indexOf("endstream",u);f>u&&(p=t.subarray(u,f))}else l=e.slice(a,o);n.set(s,{num:s,dict:l,stream:p})}return n}function Oe(t){let e=t.toString("latin1").replace(/\s/g,"");e.startsWith("<~")&&(e=e.slice(2));let n=e.indexOf("~>");n>=0&&(e=e.slice(0,n));let i=[],r=0,s=0;for(let a of e){if(a==="z"&&s===0){i.push(0,0,0,0);continue}let o=a.charCodeAt(0)-33;if(o<0||o>84)return null;r=r*85+o,s+=1,s===5&&(i.push(r>>>24&255,r>>>16&255,r>>>8&255,r&255),r=0,s=0)}if(s>0){for(let o=s;o<5;o+=1)r=r*85+84;let a=[r>>>24&255,r>>>16&255,r>>>8&255,r&255];for(let o=0;o<s-1;o+=1)i.push(a[o]??0)}return Buffer.from(i)}function je(t){let e=t.toString("latin1").replace(/\s/g,"").split(">")[0]??"",n=e.length%2?e+"0":e;return/^[0-9A-Fa-f]*$/.test(n)?Buffer.from(n,"hex"):null}function Ze(t){let e=/\/Filter\s*(\[[^\]]*\]|\/\w+)/.exec(t);return!e||!e[1]?[]:[...e[1].matchAll(/\/(\w+)/g)].map(n=>n[1]??"")}function oe(t){if(!t.stream)return null;let e=t.stream;for(let n of Ze(t.dict)){let i=null;if(n==="FlateDecode")try{i=Ue(e)}catch{return null}else if(n==="ASCII85Decode")i=Oe(e);else if(n==="ASCIIHexDecode")i=je(e);else return null;if(i===null)return null;e=i}return e.toString("latin1")}function Me(t){let e=new Map,n=1,i=/begincodespacerange([\s\S]*?)endcodespacerange/.exec(t);if(i&&i[1]){let c=/<([0-9A-Fa-f]+)>/.exec(i[1]);c&&c[1]&&c[1].length>=4&&(n=2)}let r=c=>{let l="";for(let p=0;p+3<c.length+1;p+=4){let u=parseInt(c.slice(p,p+4),16);Number.isFinite(u)&&u>0&&(l+=String.fromCharCode(u))}return l},s=/beginbfchar([\s\S]*?)endbfchar/g,a;for(;(a=s.exec(t))!==null;){let c=/<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]*)>/g,l;for(;(l=c.exec(a[1]??""))!==null;)e.set(parseInt(l[1]??"0",16),r(l[2]??""))}let o=/beginbfrange([\s\S]*?)endbfrange/g;for(;(a=o.exec(t))!==null;){let c=a[1]??"",l=/<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]+)>\s*<([0-9A-Fa-f]*)>/g,p;for(;(p=l.exec(c))!==null;){let u=parseInt(p[1]??"0",16),f=parseInt(p[2]??"0",16),d=parseInt((p[3]??"0").slice(0,4)||"0",16);if(!(f-u>65535))for(let m=u;m<=f;m+=1)e.set(m,String.fromCharCode(d+(m-u)))}}return{map:e,bytes:n}}function Ge(t){let e=new Map,n=new Map,i=[];for(let r of t.values()){let s=/\/Font\s*<<([\s\S]*?)>>/.exec(r.dict);s?.[1]&&i.push(s[1]);let a=/\/Font\s+(\d+)\s+\d+\s+R/.exec(r.dict);if(a){let o=t.get(Number(a[1]));o&&i.push(o.dict)}}for(let r of i){let s=/\/([^\s/<>[\]()]+)\s+(\d+)\s+\d+\s+R/g,a;for(;(a=s.exec(r))!==null;)n.set(a[1]??"",Number(a[2]))}for(let[r,s]of n){let a=t.get(s);if(!a)continue;let o=/\/ToUnicode\s+(\d+)\s+\d+\s+R/.exec(a.dict);if(!o)continue;let c=t.get(Number(o[1]));if(!c)continue;let l=oe(c);l&&e.set(r,Me(l))}return e}function ce(t){let e=[];for(let n=0;n<t.length;n+=1){let i=t[n];if(i!=="\\"){e.push(i.charCodeAt(0)&255);continue}let r=t[n+1];if(r===void 0)break;if(r>="0"&&r<="7"){let a="",o=n+1;for(;o<t.length&&a.length<3&&t[o]>="0"&&t[o]<="7";)a+=t[o],o+=1;e.push(parseInt(a,8)&255),n=o-1;continue}let s={n:10,r:13,t:9,b:8,f:12};e.push(s[r]??r.charCodeAt(0)&255),n+=1}return e}function le(t){if(t.length<2||t[0]!==254||t[1]!==255)return null;let e="";for(let n=2;n+1<t.length;n+=2)e+=String.fromCharCode((t[n]??0)<<8|(t[n+1]??0));return e}function ae(t,e){let n=le(t);if(n!==null)return n;if(!e)return t.map(r=>String.fromCharCode(r)).join("");let i="";if(e.bytes===2)for(let r=0;r+1<t.length;r+=2){let s=(t[r]??0)<<8|(t[r+1]??0);i+=e.map.get(s)??""}else for(let r of t)i+=e.map.get(r)??String.fromCharCode(r);return i}function Ke(t,e){let n="",i,r=/\/([^\s/<>[\]()]+)\s+[\d.]+\s+Tf|\((?:\\.|[^\\)])*\)|<[0-9A-Fa-f\s]*>|TJ|Tj|'|"/g,s,a="";for(;(s=r.exec(t))!==null;){let o=s[0];if(o.endsWith("Tf")){i=e.get(s[1]??"");continue}if(o==="TJ"||o==="Tj"||o==="'"||o==='"'){a&&(n+=a+`
|
|
4
|
+
`,a="");continue}if(o.startsWith("("))a+=ae(ce(o.slice(1,-1)),i);else if(o.startsWith("<")){let c=o.slice(1,-1).replace(/\s+/g,""),l=[];for(let p=0;p+1<c.length;p+=2)l.push(parseInt(c.slice(p,p+2),16));a+=ae(l,i)}}return a&&(n+=a+`
|
|
5
|
+
`),n}function We(t,e){let n=t.toString("latin1"),i=/\/Info\s+(\d+)\s+\d+\s+R/.exec(n),r=i?e.get(Number(i[1]))?.dict:void 0;if(!r)return"";let s=[],a=/\/(Author|Title|Subject|Keywords|Creator|Producer)\s*(\((?:\\.|[^\\)])*\)|<[0-9A-Fa-f\s]*>)/g,o;for(;(o=a.exec(r))!==null;){let c=o[2]??"";if(c.startsWith("(")){let l=ce(c.slice(1,-1));s.push(le(l)??l.map(p=>String.fromCharCode(p)).join(""))}else{let l=c.slice(1,-1).replace(/\s+/g,""),p="";if(l.toUpperCase().startsWith("FEFF"))for(let u=4;u+3<l.length+1;u+=4)p+=String.fromCharCode(parseInt(l.slice(u,u+4),16));else for(let u=0;u+1<l.length;u+=2)p+=String.fromCharCode(parseInt(l.slice(u,u+2),16));s.push(p)}}return s.join(`
|
|
6
|
+
`)}function de(t){if(!t.subarray(0,8).toString("latin1").startsWith("%PDF-")||t.toString("latin1",0,Math.min(t.length,4096)).includes("/Encrypt"))return null;let n=Be(t);if(n.size===0)return null;let i=Ge(n),r=[];r.push(We(t,n));let s=0,a=0,o=!1;for(let c of n.values()){if(!c.stream||/\/Subtype|\/Type\s*\/(XObject|Font|Metadata)|\/FontFile/.test(c.dict))continue;let l=oe(c);if(l===null||!/(TJ|Tj)\b/.test(l))continue;let p=Ke(l,i);if(p.trim().length!==0){if(a+=1,s+p.length>se){r.push(p.slice(0,Math.max(0,se-s))),o=!0;break}r.push(p),s+=p.length}}return a===0?null:{text:r.join(`
|
|
7
|
+
`),truncated:o,streams:a}}var pe=new Set([".xlsx",".xlsm",".docx",".pptx"]),Z=8*1024*1024,Xe=101010256,Je=33639248,Ye=67324752;function M(t){let e=Math.min(t.length,67584),n=-1;for(let a=t.length-22;a>=t.length-e&&a>=0;a-=1)if(t.readUInt32LE(a)===Xe){n=a;break}if(n<0)return null;let i=t.readUInt16LE(n+10),r=t.readUInt32LE(n+16);if(r>=t.length)return null;let s=[];for(let a=0;a<i&&!(r+46>t.length||t.readUInt32LE(r)!==Je);a+=1){let o=t.readUInt16LE(r+10),c=t.readUInt32LE(r+20),l=t.readUInt32LE(r+24),p=t.readUInt16LE(r+28),u=t.readUInt16LE(r+30),f=t.readUInt16LE(r+32),d=t.readUInt32LE(r+42),m=t.subarray(r+46,r+46+p).toString("utf8");s.push({name:m,method:o,compSize:c,uncompSize:l,localHeaderOffset:d}),r+=46+p+u+f}return s}function G(t,e){let n=e.localHeaderOffset;if(n+30>t.length||t.readUInt32LE(n)!==Ye)return null;let i=t.readUInt16LE(n+26),r=t.readUInt16LE(n+28),s=n+30+i+r,a=s+e.compSize;if(a>t.length)return null;let o=t.subarray(s,a);try{if(e.method===0)return Buffer.from(o);if(e.method===8)return Ve(o)}catch{return null}return null}function qe(t,e){return G(t,e)?.toString("utf8")??null}var Qe={"&":"&","<":"<",">":">",""":'"',"'":"'"};function w(t){return t.replace(/&(amp|lt|gt|quot|apos);/g,e=>Qe[e]??e).replace(/&#(\d+);/g,(e,n)=>{let i=Number(n);return i>0&&i<1114112?String.fromCodePoint(i):""}).replace(/&#x([0-9a-fA-F]+);/g,(e,n)=>{let i=parseInt(n,16);return i>0&&i<1114112?String.fromCodePoint(i):""})}function et(t){return w(t.replace(/<[^>]*>/g,`
|
|
8
|
+
`)).replace(/\n{2,}/g,`
|
|
9
|
+
`)}function tt(t,e,n){let i=new RegExp(`<${e}\\b[^>]*\\b${n}="([^"]*)"`,"g"),r=[],s;for(;(s=i.exec(t))!==null;)s[1]&&r.push(w(s[1]));return r}function nt(t,e){let n=[];for(let i of e)(i==="docProps/core.xml"||i==="docProps/app.xml")&&n.push(i);if(t===".xlsx"||t===".xlsm")for(let i of e)(i==="xl/sharedStrings.xml"||i==="xl/workbook.xml"||/^xl\/worksheets\/sheet\d+\.xml$/.test(i)||/^xl\/comments\d*\.xml$/.test(i))&&n.push(i);else if(t===".docx")for(let i of e)(i==="word/document.xml"||/^word\/(header|footer|footnotes|endnotes|comments)\d*\.xml$/.test(i))&&n.push(i);else if(t===".pptx")for(let i of e)/^ppt\/(slides|notesSlides)\/(slide|notesSlide)\d+\.xml$/.test(i)&&n.push(i);return n}function it(t,e){let n=M(t);if(!n||n.length===0)return null;let i=new Map(n.map(l=>[l.name,l])),r=nt(e,n.map(l=>l.name));if(r.length===0)return null;let s=[],a=[],o=0,c=!1;for(let l of r){if(o>=Z){c=!0;break}let p=i.get(l);if(!p)continue;let u=qe(t,p);if(u===null)continue;let f=et(u);if(l==="xl/workbook.xml"){let d=tt(u,"sheet","name");d.length&&(f+=`
|
|
10
|
+
`+d.join(`
|
|
11
|
+
`))}o+f.length>Z&&(f=f.slice(0,Math.max(0,Z-o)),c=!0),f.trim().length!==0&&(s.push(f),a.push(l),o+=f.length)}return s.length===0?null:{text:s.join(`
|
|
12
|
+
`),truncated:c,parts:a}}function K(t,e){if(pe.has(e))return it(t,e);if(j.has(e)){let n=de(t);return n?{text:n.text,truncated:n.truncated,parts:[`pdf:${n.streams}-streams`]}:null}return null}var rt=new Set([...pe,...j]);var sn=64*1024*1024,an=32*1024;var ue={israeli_id:"[ID]",credit_card:"[CARD]",iban:"[IBAN]",israeli_phone:"[PHONE]",email:"[EMAIL]"},st=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,at=[...re].sort((t,e)=>+(e.subkind==="iban")-+(t.subkind==="iban"));function P(t,e,n=1){t[e]=(t[e]??0)+n}function x(t,e={}){let n=t;for(let i of at)i.pattern.lastIndex=0,n=n.replace(i.pattern,r=>i.validate(r)?(P(e,i.subkind),ue[i.subkind]??`[${i.subkind.toUpperCase()}]`):r);n=n.replace(st,()=>(P(e,"email"),ue.email));for(let i of U()){let r=i.find(n).sort((s,a)=>a.start-s.start);for(let s of r)n=n.slice(0,s.start)+`[${i.kind.toUpperCase()}]`+n.slice(s.end),P(e,i.kind)}return{text:n,counts:e,columnsHidden:[]}}function W(){let t=new Map,e={};return(n,i)=>{let r=`${n}\0${i.trim()}`,s=t.get(r);return s===void 0&&(s=e[n]=(e[n]??0)+1,t.set(r,s)),`[${n.toUpperCase()}-${s}]`}}var me=/^\s*-?\d+(?:\.\d+)?\s*$/;function V(t){let e=new Set;for(let[n,i]of t){let r=i.filter(a=>me.test(a));if(r.length<3)continue;r.filter(a=>x(a).text!==a).length/r.length<.5&&e.add(n)}return e}function fe(t,e){return t.includes(e)||t.includes('"')||t.includes(`
|
|
13
|
+
`)?`"${t.replace(/"/g,'""')}"`:t}function ot(t){let e=(t.match(/\t/g)??[]).length,n=(t.match(/;/g)??[]).length,i=(t.match(/,/g)??[]).length;return e>i&&e>=n?" ":n>i?";":","}function X(t,e){let n=t.split(/\r?\n/),i=e??ot(n[0]??""),r=R(n[0]??"",i),s=r.map(f=>T(f)),a={},o=W(),c=n.slice(1).map(f=>f===""?null:R(f,i)),l=new Map;for(let f of c)f?.forEach((d,m)=>l.set(m,[...l.get(m)??[],d]));let p=V(l),u=[r.map(f=>fe(f,i)).join(i)];for(let f of c){if(f===null){u.push("");continue}let d=f.map((m,y)=>{let v=s[y];return v&&m.trim()!==""?(P(a,`column:${v.type}`),o(v.type,m)):p.has(y)&&me.test(m)?m:x(m,a).text});u.push(d.map(m=>fe(m,i)).join(i))}return{text:u.join(`
|
|
14
|
+
`),counts:a,columnsHidden:r.filter((f,d)=>s[d])}}import{deflateRawSync as ct}from"node:zlib";var lt=/^xl\/(pivotCache|charts|externalLinks)\//,dt=10;function pt(t,e,n=1){t[e]=(t[e]??0)+n}function ye(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function be(t){let e=t.replace(/<rPh\b[\s\S]*?<\/rPh>/g,""),n="";for(let i of e.matchAll(/<t(?:\s[^>]*)?>([\s\S]*?)<\/t>/g))n+=i[1];return w(n)}function ut(t){return t?[...t.matchAll(/<si\b[^>]*>([\s\S]*?)<\/si>|<si\b[^>]*\/>/g)].map(e=>be(e[1]??"")):[]}var he=/<c\b([^>]*?)(?:\/>|>([\s\S]*?)<\/c>)/g;function L(t,e){let n=new RegExp(`\\b${e}="([^"]*)"`).exec(t);return n?n[1]:null}function J(t,e){if(t.type==="s"){let i=/<v>([^<]*)<\/v>/.exec(t.inner);return i?e[Number(i[1])]??null:null}if(t.type==="inlineStr"){let i=/<is>([\s\S]*?)<\/is>/.exec(t.inner);return i?be(i[1]):null}if(t.type==="b"||t.type==="e")return null;let n=/<v>([^<]*)<\/v>/.exec(t.inner);return n?w(n[1]):null}function ge(t,e){return`<c${t.replace(/\s*\bt="[^"]*"/,"")} t="inlineStr"><is><t xml:space="preserve">${ye(e)}</t></is></c>`}var ft=(()=>{let t=new Uint32Array(256);for(let e=0;e<256;e+=1){let n=e;for(let i=0;i<8;i+=1)n=n&1?3988292384^n>>>1:n>>>1;t[e]=n>>>0}return t})();function mt(t){let e=4294967295;for(let n=0;n<t.length;n+=1)e=ft[(e^t[n])&255]^e>>>8;return(e^4294967295)>>>0}function _e(t){let e=[],n=[],i=0;for(let a of t){let o=Buffer.from(a.name,"utf8"),c=a.name.endsWith("/"),l=c?Buffer.alloc(0):ct(a.data),p=c?0:8,u=c?0:mt(a.data),f=Buffer.alloc(30);f.writeUInt32LE(67324752,0),f.writeUInt16LE(20,4),f.writeUInt16LE(2048,6),f.writeUInt16LE(p,8),f.writeUInt32LE(u,14),f.writeUInt32LE(l.length,18),f.writeUInt32LE(a.data.length,22),f.writeUInt16LE(o.length,26),e.push(f,o,l);let d=Buffer.alloc(46);d.writeUInt32LE(33639248,0),d.writeUInt16LE(20,4),d.writeUInt16LE(20,6),d.writeUInt16LE(2048,8),d.writeUInt16LE(p,10),d.writeUInt32LE(u,16),d.writeUInt32LE(l.length,20),d.writeUInt32LE(a.data.length,24),d.writeUInt16LE(o.length,28),d.writeUInt32LE(i,42),n.push(d,o),i+=f.length+o.length+l.length}let r=Buffer.concat(n),s=Buffer.alloc(22);return s.writeUInt32LE(101010256,0),s.writeUInt16LE(t.length,8),s.writeUInt16LE(t.length,10),s.writeUInt32LE(r.length,12),s.writeUInt32LE(i,16),Buffer.concat([...e,r,s])}function Y(t){let e=M(t);if(!e||e.length===0||e.some(d=>lt.test(d.name)))return null;let n=new Map;for(let d of e){if(d.name.endsWith("/")){n.set(d.name,Buffer.alloc(0));continue}let m=G(t,d);if(!m)return null;n.set(d.name,m)}let i=[...n.keys()].filter(d=>/^xl\/worksheets\/sheet\d+\.xml$/.test(d));if(i.length===0)return null;let r=n.get("xl/sharedStrings.xml")?.toString("utf8")??null,s=ut(r),a=new Set,o={},c=new Set,l=W();for(let d of i){let m=n.get(d).toString("utf8"),y=[];for(let h of m.matchAll(he)){let g=L(h[1],"r"),b=g?/^([A-Z]+)(\d+)$/.exec(g):null;if(!b)return null;y.push({full:h[0],attrs:h[1],inner:h[2]??"",col:b[1],row:Number(b[2]),type:L(h[1],"t")??"n"})}let v=[...new Set(y.map(h=>h.row))].sort((h,g)=>h-g).slice(0,dt),I=-1,C=new Map;for(let h of v){let g=new Map;for(let b of y.filter(_=>_.row===h)){let _=J(b,s),S=_?T(_):null;S&&(g.set(b.col,S.type),c.add(_.trim()))}if(g.size>0){I=h;for(let[b,_]of g)C.set(b,_);break}}let E=new Map;for(let h of y){if(h.type!=="n"||h.row<=I)continue;let g=J(h,s);g!==null&&E.set(h.col,[...E.get(h.col)??[],g])}let F=V(E),Re=m.replace(he,(h,g,b)=>{let _=L(g,"r"),[,S,Pe]=/^([A-Z]+)(\d+)$/.exec(_),A={full:h,attrs:g,inner:b??"",col:S,row:Number(Pe),type:L(g,"t")??"n"},$=J(A,s),H=()=>{if(A.type==="s"){let ee=/<v>([^<]*)<\/v>/.exec(A.inner);ee&&a.add(Number(ee[1]))}return h};if($===null||$.trim()==="")return H();let z=C.get(S);if(z&&A.row>I)return pt(o,`column:${z}`),ge(g,l(z,$));if(A.type==="n"&&F.has(S))return H();let Q=x($,o);return Q.text===$?H():ge(g,Q.text)});n.set(d,Buffer.from(Re,"utf8"))}if(r){let d=-1,m=r.replace(/<si\b[^>]*>[\s\S]*?<\/si>|<si\b[^>]*\/>/g,y=>(d+=1,a.has(d)?y:"<si><t></t></si>"));n.set("xl/sharedStrings.xml",Buffer.from(m,"utf8"))}for(let d of[...n.keys()].filter(m=>/^xl\/comments\d*\.xml$/.test(m))){let y=n.get(d).toString("utf8").replace(/(<t(?:\s[^>]*)?>)([\s\S]*?)(<\/t>)/g,(v,I,C,E)=>{let F=x(w(C),o);return`${I}${ye(F.text)}${E}`});n.set(d,Buffer.from(y,"utf8"))}let p=n.get("docProps/core.xml");if(p){let d=p.toString("utf8").replace(/(<dc:creator>)[\s\S]*?(<\/dc:creator>)/,"$1$2").replace(/(<cp:lastModifiedBy>)[\s\S]*?(<\/cp:lastModifiedBy>)/,"$1$2");n.set("docProps/core.xml",Buffer.from(d,"utf8"))}let u=n.has("xl/calcChain.xml"),f=e.map(d=>d.name).filter(d=>!(u&&d==="xl/calcChain.xml"));if(u)for(let d of["[Content_Types].xml","xl/_rels/workbook.xml.rels"]){let m=n.get(d);m&&n.set(d,Buffer.from(m.toString("utf8").replace(/<(Override|Relationship)\b[^>]*calcChain[^>]*\/>/g,""),"utf8"))}return{bytes:_e(f.map(d=>({name:d,data:n.get(d)}))),counts:o,columnsHidden:[...c]}}function xe(t){return/\.ndc$/i.test(t)||/\.clean\.[A-Za-z0-9]+$/.test(t)}var vt=new Set([".csv",".tsv",".txt",".md",".json",".log",".xml",".sql",".yaml",".yml",".xlsx",".xlsm",".docx",".pptx",".pdf"]),St=50*1024*1024,wt=8,It={israeli_id:"Israeli ID",credit_card:"card",iban:"IBAN",israeli_phone:"phone",email:"email",secret:"secret"};function Ie(t){let e=_t(t).toLowerCase();return vt.has(we(e))||e===".env"||e.startsWith(".env.")}function Et(t){let e=we(t).toLowerCase(),n=bt(t),i,r;if(e===".csv"||e===".tsv")r=n.toString("utf8"),i=X(r,e===".tsv"?" ":void 0).counts;else if(e===".xlsx"||e===".xlsm"||e===".docx"||e===".pptx"||e===".pdf"){let a=e===".xlsx"||e===".xlsm"?Y(n):null;r=K(n,e)?.text??"",i=a?a.counts:x(r).counts}else r=n.toString("utf8"),i=x(r).counts;let s=ne.filter(a=>a.pattern.test(r)).length;return s&&(i.secret=(i.secret??0)+s),i}function At(t){return Object.entries(t).sort((e,n)=>n[1]-e[1]).map(([e,n])=>`${n} ${e.startsWith("column:")?`${e.slice(7)} (column)`:It[e]??e}`).join(", ")}function $t(t,e,n){let i=s=>xt(s)?s:kt(n,s),r=s=>{try{return ve(s).isFile()}catch{return!1}};if(t==="Read"&&typeof e.file_path=="string")return[i(e.file_path)];if(t==="Grep"&&typeof e.path=="string"&&r(i(e.path)))return[i(e.path)];if(t==="Bash"&&typeof e.command=="string"){let s=e.command.match(/"[^"]*"|'[^']*'|[^\s|;&<>()]+/g)??[],a=[];for(let o of s){let c=i(o.replace(/^['"]|['"]$/g,"").replace(/^~(?=\/)/,Se()));if(Ie(c)&&r(c)&&!a.includes(c)&&a.push(c),a.length>=wt)break}return a}return[]}function q(t){return t.replace(/\\+/g,"/")}function Tt(t,e,n,i){let r=[];for(let a of $t(t,e,n)){if(!Ie(a)||xe(a)||!gt(a))continue;let o;try{if(ve(a).size>St)o=`${q(a)}: too large to check here (over 50 MB)`;else{let c=Et(a);if(Object.keys(c).length===0)continue;o=`${q(a)}: ${At(c)}`}}catch{o=`${q(a)}: could not be checked`}r.push(o)}if(r.length===0)return{decision:"allow"};let s=`NoData scanned this on your machine before the assistant reads it:
|
|
15
|
+
${r.join(`
|
|
16
|
+
`)}
|
|
17
|
+
Reading it puts these values in front of the AI. Safer: nodata_redact (a clean copy to work on) or nodata_protect (lock it).`+(i?"":" Allow this read anyway?");return{decision:i?"deny":"ask",reason:s}}function Ct(t){try{let e=ke(Se(),".nodata");yt(e,{recursive:!0}),ht(ke(e,"gate.log"),JSON.stringify({at:new Date().toISOString(),...t})+`
|
|
18
|
+
`,{mode:384})}catch{}}async function Ee(t){let e=t.includes("--block"),n="";for await(let a of process.stdin)n+=a;let i;try{i=JSON.parse(n)}catch{return}let r=i.tool_name??"",s=Tt(r,i.tool_input??{},i.cwd??process.cwd(),e);s.decision!=="allow"&&(Ct({tool:r,decision:s.decision}),process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:s.decision,permissionDecisionReason:s.reason}})))}var Rt=[{type:"id_number",patterns:[/\b\d{9}\b/g,/ת\.?ז\.?\s*:?\s*(\d{9})/g,/זהות\s*:?\s*(\d{9})/g],confidence:.9,replacement:()=>"[\u05EA.\u05D6. \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"phone",patterns:[/\b0[2-9]\d[\s\-]?\d{7}\b/g,/\b05[0-9][\s\-]?\d{7}\b/g,/\+972[\s\-]?[2-9]\d[\s\-]?\d{7}\b/g],confidence:.95,replacement:()=>"[\u05D8\u05DC\u05E4\u05D5\u05DF \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"email",patterns:[/[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}/g],confidence:.99,replacement:t=>{let[,e]=t.split("@");return`[\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC: ***@${e}]`}},{type:"full_name",patterns:[/(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק)[:\s]+([א-ת][א-ת"'\-\s]{2,30}?)(?=[,\n\d]|ת\.ז)/g,/(?:עו"ד|ד"ר|פרופ'|מר|גברת)\s+([א-ת][א-ת"'\-\s]{2,25}?)(?=[,\n])/g],confidence:.75,replacement:()=>"[\u05E9\u05DD \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"bank_account",patterns:[/\b\d{2}[\-]\d{5,9}[\-]\d{2,3}\b/g,/(?:חשבון|ח-ן)\s*:?\s*(\d[\d\-]{8,15})/g],confidence:.88,replacement:()=>"[\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"medical",patterns:[/(?<![א-ת])[בהוכלמש]{0,2}(?:סוכרת|יתר לחץ דם|אסתמה|דיכאון|חרדה|סרטן|אי ספיקת לב|אפילפסיה)(?![א-ת])/g,/\b(?:Metformin|Lisinopril|Atorvastatin|Amlodipine|Sertraline|Fluoxetine|Omeprazole|Warfarin|Aspirin|Insulin)\b/gi,/\bHbA1c\s*:?\s*[\d.]+%?/g,/\bBMI\s*:?\s*[\d.]+/g,/(?<![א-ת])[בהוכלמש]{0,2}אבחנ[הות]\s*:?\s*[^,\n.]{2,40}/g],confidence:.85,replacement:()=>"[\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"financial_amount",patterns:[/[\d,]+(?:\.\d{2})?\s*(?:₪|ש"ח|NIS|שקל(?:ים)?)/g,/(?:₪|NIS)\s*[\d,]+(?:\.\d{2})?/g],confidence:.92,replacement:()=>"[\u05E1\u05DB\u05D5\u05DD \u05DB\u05E1\u05E4\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"birth_date",patterns:[/(?:תאריך לידה|נולד|נולדה|ד\.ל\.)\s*:?\s*\d{1,2}[\/\.\-]\d{1,2}[\/\.\-]\d{2,4}/g,/(?<![א-ת])[בהוכלמש]{0,2}גיל\s*:?\s*\d{1,3}\b/g],confidence:.88,replacement:()=>"[\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4 \u05DE\u05D5\u05E1\u05EA\u05E8]"},{type:"address",patterns:[/רחוב\s+[א-ת][א-ת\s"'\-]{2,30}\s+\d{1,5}/g,/(?:רח'|רח\.)\s+[א-ת][א-ת\s"'\-]{2,30}\d{1,5}/g],confidence:.72,replacement:()=>"[\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D5\u05E1\u05EA\u05E8\u05EA]"},{type:"license_plate",patterns:[/\b\d{2,3}[\-]\d{2,3}[\-]\d{2,3}\b/g],confidence:.8,replacement:()=>"[\u05DC\u05D5\u05D7\u05D9\u05EA \u05E8\u05D9\u05E9\u05D5\u05D9 \u05DE\u05D5\u05E1\u05EA\u05E8\u05EA]"}];function Pt(t){if(t.length!==9)return!1;let e=t.split("").map(Number),n=0;for(let i=0;i<9;i++){let r=e[i]*(i%2===0?1:2);r>9&&(r-=9),n+=r}return n%10===0}var D=class{constructor(e){this.enabledTypes=new Set(e)}detect(e){let n=[],i=new Set;for(let s of Rt)if(this.enabledTypes.has(s.type))for(let a of s.patterns){let o=new RegExp(a.source,a.flags),c;for(;(c=o.exec(e))!==null;){let l=c[0],p=`${s.type}:${c.index}`;if(!i.has(p)){if(i.add(p),s.type==="id_number"){let u=l.replace(/\D/g,"");if(/^\d{9}$/.test(l)&&u.length===9&&!Pt(u))continue}n.push({type:s.type,value:l,startIndex:c.index,endIndex:c.index+l.length,confidence:s.confidence,replacement:s.replacement(l,s.type)})}}}n.sort((s,a)=>s.startIndex-a.startIndex||a.confidence-s.confidence);let r=[];for(let s of n)r.some(o=>s.startIndex<o.endIndex&&s.endIndex>o.startIndex)||r.push(s);return r}};var Lt=[{type:"biometric",tokens:["biometric","fingerprint","\u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9"],phrases:["face id","\u05D8\u05D1\u05D9\u05E2\u05EA \u05D0\u05E6\u05D1\u05E2"]},{type:"medical",tokens:["diagnosis","medical","disease","medication","prescription","allergy","vaccine","\u05D0\u05D1\u05D7\u05D5\u05DF","\u05D0\u05D1\u05D7\u05E0\u05D4","\u05DE\u05D7\u05DC\u05D4","\u05EA\u05E8\u05D5\u05E4\u05D4","\u05DE\u05E8\u05E9\u05DD","\u05D7\u05D9\u05E1\u05D5\u05DF","\u05D0\u05DC\u05E8\u05D2\u05D9\u05D4"],phrases:["medical record","blood type","\u05DE\u05E6\u05D1 \u05E8\u05E4\u05D5\u05D0\u05D9","\u05E1\u05D5\u05D2 \u05D3\u05DD"]},{type:"sensitive_personal",tokens:["religion","ethnicity","nationality","\u05D3\u05EA","\u05DC\u05D0\u05D5\u05DD","\u05E2\u05D3\u05D4","\u05DE\u05D5\u05E6\u05D0"],phrases:["sexual orientation","marital status","\u05DE\u05E6\u05D1 \u05DE\u05E9\u05E4\u05D7\u05EA\u05D9","\u05E0\u05D8\u05D9\u05D9\u05D4 \u05DE\u05D9\u05E0\u05D9\u05EA"]},{type:"minor_data",tokens:["minor","\u05E7\u05D8\u05D9\u05DF"],phrases:["child name","\u05E9\u05DD \u05D4\u05D9\u05DC\u05D3","\u05E9\u05DD \u05D4\u05E7\u05D8\u05D9\u05DF"]},{type:"id",tokens:["ssn","passport","\u05D6\u05D4\u05D5\u05EA","\u05D3\u05E8\u05DB\u05D5\u05DF"],phrases:["national id","id number","identity number","social security","driver license","driving license","drivers license","passport number","tax id","\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA","\u05DE\u05E1\u05E4\u05E8 \u05D6\u05D4\u05D5\u05EA","\u05E8\u05D9\u05E9\u05D9\u05D5\u05DF \u05E0\u05D4\u05D9\u05D2\u05D4"]},{type:"financial",tokens:["iban","swift","bic","salary","income","wage","\u05D0\u05E9\u05E8\u05D0\u05D9","\u05E9\u05DB\u05E8","\u05DE\u05E9\u05DB\u05D5\u05E8\u05EA","\u05D4\u05DB\u05E0\u05E1\u05D4"],phrases:["bank account","account number","credit card","card number","routing number","sort code","\u05D7\u05E9\u05D1\u05D5\u05DF \u05D1\u05E0\u05E7","\u05DE\u05E1\u05E4\u05E8 \u05D7\u05E9\u05D1\u05D5\u05DF","\u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9"]},{type:"policy",tokens:["policy","\u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"],phrases:["policy number","member number","\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4"]},{type:"agent_id",tokens:["\u05DE\u05E9\u05D5\u05D5\u05E7"],phrases:["agent number","agent code","broker id","\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF"]},{type:"dob",tokens:["dob","birthdate","birthday","\u05DC\u05D9\u05D3\u05D4","\u05D4\u05D5\u05DC\u05D3\u05EA","\u05D2\u05D9\u05DC"],phrases:["date of birth","birth date","\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4"]},{type:"phone",tokens:["phone","tel","mobile","cell","fax","\u05D8\u05DC\u05E4\u05D5\u05DF","\u05E0\u05D9\u05D9\u05D3","\u05E4\u05DC\u05D0\u05E4\u05D5\u05DF","\u05E1\u05DC\u05D5\u05DC\u05E8\u05D9"],phrases:["phone number","mobile number","cell phone","\u05D8\u05DC\u05E4\u05D5\u05DF \u05E0\u05D9\u05D9\u05D3"]},{type:"email",tokens:["email","mail","\u05D0\u05D9\u05DE\u05D9\u05D9\u05DC","\u05DE\u05D9\u05D9\u05DC","\u05D3\u05D5\u05D0\u05DC"],phrases:["email address","e mail","\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D9\u05D9\u05DC"]},{type:"address",tokens:["address","street","city","zipcode","zip","postcode","\u05DB\u05EA\u05D5\u05D1\u05EA","\u05E8\u05D7\u05D5\u05D1","\u05E2\u05D9\u05E8","\u05D9\u05E9\u05D5\u05D1","\u05D9\u05D9\u05E9\u05D5\u05D1","\u05DE\u05D9\u05E7\u05D5\u05D3","\u05DE\u05E2\u05DF"],phrases:["home address","postal code","street address","zip code","\u05DB\u05EA\u05D5\u05D1\u05EA \u05DE\u05D2\u05D5\u05E8\u05D9\u05DD"]},{type:"location",tokens:["gps","latitude","longitude","geolocation","\u05DE\u05D9\u05E7\u05D5\u05DD"],phrases:["gps coordinates"]},{type:"tracking",tokens:["plate","vehicle","\u05E8\u05DB\u05D1","\u05E8\u05D9\u05E9\u05D5\u05D9"],phrases:["license plate","vehicle number","plate number","\u05DE\u05E1\u05E4\u05E8 \u05E8\u05DB\u05D1"]},{type:"name",tokens:["name","\u05E9\u05DD"],phrases:["first name","last name","full name","family name","given name","surname","\u05E9\u05DD \u05E4\u05E8\u05D8\u05D9","\u05E9\u05DD \u05DE\u05E9\u05E4\u05D7\u05D4","\u05E9\u05DD \u05DE\u05DC\u05D0"]}];function Ae(t){if(!t)return null;let e=t.trim().toLowerCase().replace(/["'`׳״]/g,"").replace(/[_\-.]+/g," ").replace(/\s+/g," ").trim();if(!e)return null;let n=new Set(e.match(/[\p{L}\p{N}]+/gu)??[]);for(let i of Lt)if(i.phrases?.some(s=>e.includes(s))||i.tokens?.some(s=>n.has(s)))return{type:i.type,label:i.type,labelHe:Dt(i.type)};return null}function Dt(t){return{id:"\u05EA\u05E2\u05D5\u05D3\u05EA \u05D6\u05D4\u05D5\u05EA",agent_id:"\u05DE\u05E1\u05E4\u05E8 \u05E1\u05D5\u05DB\u05DF",policy:"\u05DE\u05E1\u05E4\u05E8 \u05E4\u05D5\u05DC\u05D9\u05E1\u05D4",name:"\u05E9\u05DD \u05D0\u05D3\u05DD",email:"\u05D3\u05D5\u05D0\u05E8 \u05D0\u05DC\u05E7\u05D8\u05E8\u05D5\u05E0\u05D9",phone:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF",address:"\u05DB\u05EA\u05D5\u05D1\u05EA",dob:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05DC\u05D9\u05D3\u05D4",financial:"\u05E4\u05E8\u05D8\u05D9\u05DD \u05E4\u05D9\u05E0\u05E0\u05E1\u05D9\u05D9\u05DD",medical:"\u05DE\u05D9\u05D3\u05E2 \u05E8\u05E4\u05D5\u05D0\u05D9",minor_data:"\u05DE\u05D9\u05D3\u05E2 \u05E2\u05DC \u05E7\u05D8\u05D9\u05DF",sensitive_personal:"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9 \u05E8\u05D2\u05D9\u05E9",biometric:"\u05DE\u05D9\u05D3\u05E2 \u05D1\u05D9\u05D5\u05DE\u05D8\u05E8\u05D9",auth:"\u05E1\u05D9\u05E1\u05DE\u05D0\u05D5\u05EA/\u05E1\u05D5\u05D3\u05D5\u05EA",tracking:"\u05DE\u05D6\u05D4\u05D9 \u05DE\u05E2\u05E7\u05D1",location:"\u05DE\u05D9\u05E7\u05D5\u05DD"}[t]??"\u05DE\u05D9\u05D3\u05E2 \u05D0\u05D9\u05E9\u05D9"}var $e={_comment:"CANONICAL secret ruleset \u2014 the SINGLE SOURCE OF TRUTH for hardcoded-secret detection, loaded by BOTH the web scanner (lib/soc/exposure-map.ts) and the installed Capsule agent (apps/desktop/src-tauri/src/scanner.rs, via include_str!). Patterns are written in the regex subset both JavaScript and the Rust `regex` crate accept (no lookaround, no backreferences). A connection string counts only WITH credentials (user:pass@). Edit here once and both engines stay aligned.",rules:[{id:"aws-access-key",subkind:"aws_access_key",name:"AWS Access Key",severity:"critical",pattern:"(?:^|[^A-Z0-9])AKIA[A-Z2-7]{16}(?:[^A-Z2-7]|$)",hint:"AWS access key id detected. Rotate via IAM and move to an environment variable."},{id:"aws-secret-key",subkind:"aws_secret_key",name:"AWS Secret Key",severity:"critical",pattern:`(?:aws_secret_access_key|aws_secret_key|secret_access_key)\\s*[=:]\\s*['"]?[A-Za-z0-9/+=]{40}['"]?`,hint:"AWS secret access key detected. Rotate immediately."},{id:"gcp-api-key",subkind:"gcp_api_key",name:"GCP API Key",severity:"critical",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Google API key detected. Restrict or rotate it in the Google Cloud console."},{id:"gcp-service-account",subkind:"gcp_service_account",name:"GCP Service Account",severity:"critical",pattern:'"type"\\s*:\\s*"service_account"',hint:"GCP service-account JSON detected. Move it out of the repo and rotate the key."},{id:"github-token",subkind:"github_token",name:"GitHub Token",severity:"critical",pattern:"gh[pousr]_[0-9a-zA-Z]{36,}",hint:"GitHub token detected. Revoke at https://github.com/settings/tokens."},{id:"github-fine-grained",subkind:"github_fine_grained_token",name:"GitHub Fine-Grained Token",severity:"critical",pattern:"github_pat_[0-9a-zA-Z_]{22,}",hint:"GitHub fine-grained token detected. Revoke it in GitHub settings."},{id:"gitlab-token",subkind:"gitlab_token",name:"GitLab Token",severity:"critical",pattern:"glpat-[0-9a-zA-Z_-]{20,}",hint:"GitLab token detected. Revoke it in GitLab access tokens."},{id:"stripe-secret",subkind:"stripe_key",name:"Stripe Secret Key",severity:"critical",pattern:"sk_live_[0-9a-zA-Z]{24,}",hint:"Stripe live secret key detected. Roll it in the Stripe dashboard."},{id:"stripe-restricted",subkind:"stripe_restricted_key",name:"Stripe Restricted Key",severity:"critical",pattern:"rk_live_[0-9a-zA-Z]{24,}",hint:"Stripe restricted key detected. Roll it in the Stripe dashboard."},{id:"slack-token",subkind:"slack_token",name:"Slack Token",severity:"high",pattern:"xox[baprs]-[0-9a-zA-Z-]{10,}",hint:"Slack token detected. Revoke it in the Slack app settings."},{id:"slack-webhook",subkind:"slack_webhook",name:"Slack Webhook",severity:"high",pattern:"hooks\\.slack\\.com/services/T[0-9A-Z]{8,}/B[0-9A-Z]{8,}/[0-9a-zA-Z]{24}",hint:"Slack incoming-webhook URL detected. Regenerate it."},{id:"twilio-api-key",subkind:"twilio_api_key",name:"Twilio API Key",severity:"high",pattern:"SK[0-9a-fA-F]{32}",hint:"Twilio API key detected. Rotate it in the Twilio console."},{id:"sendgrid-api-key",subkind:"sendgrid_api_key",name:"SendGrid API Key",severity:"critical",pattern:"SG\\.[0-9a-zA-Z_-]{22}\\.[0-9a-zA-Z_-]{43}",hint:"SendGrid API key detected. Rotate it in the SendGrid console."},{id:"postgres-uri",subkind:"postgres_uri",name:"PostgreSQL Connection String",severity:"critical",pattern:`postgres(?:ql)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"PostgreSQL connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"mongodb-uri",subkind:"mongodb_uri",name:"MongoDB Connection String",severity:"critical",pattern:`mongodb(?:\\+srv)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"MongoDB connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"redis-uri",subkind:"redis_uri",name:"Redis Connection String",severity:"high",pattern:`redis(?:s)?://[^\\s'":/@]*:[^\\s'"@]+@[^\\s'"]+`,hint:"Redis connection string WITH credentials detected. Move it to a secret manager and rotate the password."},{id:"openai-key",subkind:"openai_key",name:"OpenAI API Key",severity:"critical",pattern:"sk-[0-9a-zA-Z]{20,}T3BlbkFJ[0-9a-zA-Z]{20,}",hint:"OpenAI API key detected. Rotate at https://platform.openai.com/api-keys."},{id:"anthropic-key",subkind:"anthropic_key",name:"Anthropic API Key",severity:"critical",pattern:"sk-ant-[0-9a-zA-Z_-]{40,}",hint:"Anthropic API key detected. Rotate at https://console.anthropic.com/."},{id:"firebase-key",subkind:"firebase_key",name:"Firebase API Key",severity:"high",pattern:"AIza[0-9A-Za-z_-]{35}",hint:"Firebase API key detected. Restrict it in the Firebase console."},{id:"supabase-key",subkind:"supabase_key",name:"Supabase Service Key",severity:"critical",pattern:"eyJ[0-9a-zA-Z_-]{100,}",hint:"Long JWT (possible Supabase service key) detected. Rotate it and keep it server-side only."},{id:"private-key",subkind:"private_key",name:"Private Key",severity:"critical",pattern:"-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----",hint:"Private key material in plaintext. Rotate immediately and move to a key manager (KMS/Vault).",skipPlaceholder:!0},{id:"jwt-secret",subkind:"jwt_secret",name:"JWT/Generic Secret",severity:"high",pattern:`(?:jwt_secret|JWT_SECRET|secret_key|SECRET_KEY|api_secret|API_SECRET)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded signing/API secret detected. Move it to an environment variable and rotate it."},{id:"password-in-code",subkind:"password_in_code",name:"Password in Code",severity:"high",pattern:`(?:password|passwd|pwd)\\s*[=:]\\s*['"][^'"]{8,}['"]`,hint:"Hardcoded password detected. Move it to a secret manager and rotate it."},{id:"bearer-token",subkind:"bearer_token",name:"Bearer Token in Code",severity:"high",pattern:`['"]Bearer\\s+[0-9a-zA-Z._-]{20,}['"]`,hint:"Hardcoded bearer token detected. Move it to a secret manager and rotate it."},{id:"hex-secret-32",subkind:"hex_secret",name:"Hardcoded 32+ Hex Secret",severity:"medium",pattern:`['"][0-9a-f]{32,}['"]`,hint:"Long hex string that looks like a secret/hash. Confirm it is not a live credential."},{id:"base64-secret",subkind:"base64_secret",name:"Hardcoded Base64 Secret (long)",severity:"medium",pattern:`['"][A-Za-z0-9+/]{64,}={0,2}['"]`,hint:"Long base64 blob that looks like an embedded secret. Confirm it is not a live credential."}]};var Ht=[{type:"full_name",kind:"name",severity:"medium",hint:`A person's name in free text (after a role word such as \u05DC\u05E7\u05D5\u05D7 / \u05DE\u05E8 / \u05E2\u05D5"\u05D3).`},{type:"bank_account",kind:"bank_account",severity:"high",hint:"An Israeli bank account number (branch-account-check form) in plaintext."},{type:"medical",kind:"medical",severity:"high",hint:"Medical information (diagnosis, medication, lab value) in plaintext."},{type:"birth_date",kind:"dob",severity:"medium",hint:"A date of birth in plaintext."},{type:"address",kind:"address",severity:"medium",hint:"A street address in plaintext."},{type:"license_plate",kind:"plate",severity:"low",hint:"A vehicle licence plate in plaintext."}],zt=/^(?:לקוח|מטופל|מועמד|שם|נהג|מבוטח|תובע|נתבע|שוכר|מחזיק|עו"ד|ד"ר|פרופ'|מר|גברת|חשבון|ח-ן|[בהוכלמש]{0,2}אבחנ[הות]|תאריך לידה|נולד|נולדה|ד\.ל\.|[בהוכלמש]{0,2}גיל)\s*:?\s*/;function Nt(t,e,n,i){if(i==="address")return{start:e,end:n};let r=zt.exec(t.slice(e,n));return r&&e+r[0].length<n?{start:e+r[0].length,end:n}:{start:e,end:n}}var Ut=new Set(["hex-secret-32","base64-secret"]),Te=!1;function Ce(){if(Te)return;Te=!0;let t=Ht.map(({type:n,kind:i,severity:r,hint:s})=>{let a=new D([n]);return{kind:i,severity:r,hint:s,find:o=>a.detect(o).map(c=>Nt(o,c.startIndex,c.endIndex,i))}}),e=$e.rules.filter(n=>!Ut.has(n.id)).map(n=>({id:n.id,name:n.name,severity:n.severity,pattern:new RegExp(n.pattern)}));N({text:t,header:n=>{let i=Ae(n);return i?{type:i.type,label:i.labelHe||i.label}:null},secrets:e})}Ce();Ee(process.argv.slice(2)).catch(()=>{process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"ask",permissionDecisionReason:"NoData could not check this file before it is read. Allow anyway?"}}))});
|