# =redact: EXAMPLE company redactor. It only matches the example patterns below
# (corp.example.com, the RFC 1918 IP ranges, EMP-12345, PROJ/OPS/INFRA/SEC tickets),
# so it only catches what is configured: edit the patterns for your company before you
# rely on it, and read the output before you share it. Masks employee IDs, internal hostnames, internal
# IP addresses and ticket numbers in a pasted block before you share it. Pure transform:
# on-device, no command, no network.
#
# Not covered here, on purpose: SSNs and emails (the shipped =scrub-pii app) and API
# keys and other secrets (Bolt's built-in secret masking).
#
# HOW TO MAKE IT YOURS: the four steps under `transform.pipe` are EXAMPLES. Edit the
# `from` pattern of each to match your company, keep the `to` label or change it.
#   1. hostnames   example: anything ending in .corp.example.com
#                  edit:    replace corp.example.com with your domain (keep the \. between words)
#   2. IP ranges   example: 10.x.x.x, 172.16-31.x.x and 192.168.x.x
#                  edit:    delete a line you do not want; add a line for another range
#   3. employee id example: EMP-12345 (EMP, a hyphen, 4 to 8 digits)
#                  edit:    change EMP to your prefix and the digit counts to your format
#   4. tickets     example: PROJ-12, OPS-3401, INFRA-88, SEC-7
#                  edit:    replace the PROJ|OPS|INFRA|SEC list with your project keys
#                  (a generic \b[A-Z][A-Z0-9]{1,9}-\d{1,7}\b catches every KEY-123 but
#                  also UTF-8 or SHA-256, so a named list is safer)
# Patterns are JavaScript regex run by the app (src/lib/services/transform/pipe.ts); the
# manifest check only enforces a length cap and refuses a quantifier outside a group that
# holds a quantifier, such as (a+)+. Step flags default to g; this file sets gi on the
# hostname step so CORP.EXAMPLE.COM is caught too. The IP steps keep the character in front
# with $1 and use a lookahead behind, so they match a whole dotted address only: octets 0 to
# 255, and never part of a longer dotted number (1.10.20.30.40, 10.1.2.3.4 stay as typed).
# The employee-id and ticket steps are case sensitive.
# Order matters: hostnames run first so a name like emp-1.corp.example.com is masked whole.
# `recognize` below only decides when Bolt offers this app on pasted text; if you add or
# change a pattern above, change the matching line there too (or ignore it and type =redact).
schema_version: 1
runtime: transform
id: redact
chip: redact
title: Company redactor (example patterns, edit them)
icon: shield-off
description: "EXAMPLE patterns only (corp.example.com, private IP ranges, EMP-12345, PROJ-12): edit them to match your company. Masks employee IDs, internal hostnames, IPs and ticket numbers in a pasted block, and only catches what is configured. Pure, on-device"
placeholder_examples: ["EXAMPLE patterns only: EMP-12345 fixed PROJ-88 on build01.corp.example.com (10.2.3.4)"]
emits: Generic

transform:
  pipe:
    - replace: { from: '\b[A-Za-z0-9._-]{1,100}\.corp\.example\.com\b', to: '[internal-host]', flags: gi }
    - replace: { from: '(^|[^\d.])10\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?!\d|\.\d)', to: '$1[internal-ip]' }
    - replace: { from: '(^|[^\d.])172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?!\d|\.\d)', to: '$1[internal-ip]' }
    - replace: { from: '(^|[^\d.])192\.168\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?!\d|\.\d)', to: '$1[internal-ip]' }
    - replace: { from: '\bEMP-\d{4,8}\b', to: '[employee-id]' }
    - replace: { from: '\b(?:PROJ|OPS|INFRA|SEC)-\d{1,7}\b', to: '[ticket]' }

recognize:
  patterns:
    - regex: '\.(?:corp|CORP)\.(?:example|EXAMPLE)\.(?:com|COM)\b'
    - regex: '\b10\.\d{1,3}\.\d{1,3}\.\d{1,3}\b'
    - regex: '\bEMP-\d{4,8}\b'
    - regex: '\b(?:PROJ|OPS|INFRA|SEC)-\d{1,7}\b'
  confidence: ambient

presentation:
  widget: list
  title_field: line
