גרסה חדשהv0.11.14Aug 13, 2026

גרסה חדשה של Boost זמינהExpanded reporting and agent setup

$ reference

מסנני TOML

Boost דוחס עם parsers ב-Go ומסנני TOML declarative לשאר. שימו קבצי מסנן בודד תחת ~/.boost/filters/ או .boost/filters/ — בלי recompile.

איפה מסננים נטענים

Boost ממזג מסננים ממספר מיקומים ומחיל כל מסנן שנבחר לפי הפקודה או הפלט. קבצים בתיקייה נטענים בסדר דטרמיניסטי.

  1. מסננים מובנים שמגיעים עם Boost (make, terraform, shellcheck, …)
  2. ~/.boost/filters/*.toml (תיקייה גלובלית, מסנן לקובץ)
  3. .boost/filters/*.toml בפרויקט (תיקייה, מסנן לקובץ)

המקורות מתמזגים, לא נדרסים. מסנן פרויקט לא מחליף builtin באותו שם — שניהם נטענים (name + source), וכל מסנן ש-match_command או match_output_select שלו פוגע מוחל בסדר טעינה (builtin → global → project). כדי להחליף builtin: boost filters disable ופרסמו משלכם.


פריסת תיקיות (מסנן לקובץ)

מסננים מותאמים חיים בקבצים של מסנן אחד: כל קובץ מכיל בלוק [filters.<name>] ודוגמאות [[tests.<name>]].

~/.boost/filters/
  git-status.toml      # [filters.git-status] + [[tests.git-status]]
  my-deploy.toml       # [filters.my-deploy] + [[tests.my-deploy]]

מסננים ב-~/.boost/filters/ נטענים בתהליך boost הבא בלי rebuild.


בוררים ושדות נפוצים

כל מסנן צריך לפחות בורר אחד. השדות האלה מופיעים כמעט בכל דוגמה; המילון המלא בתחתית העמוד.

שדהמטרה
match_commandSelect by command line (capture path)
match_output_selectSelect by piped output signature (hook path); use (?m) for line anchors
strip_ansiRemove terminal color codes first
strip_lines_matchingDrop lines matching any pattern
keep_lines_matchingKeep only matching lines
on_emptyMessage when filtering removes everything

סוג ה-regex

כל התבניות משתמשות בחבילת regexp של Go (תחביר RE2), לא PCRE. בלי backreferences או lookbehind. עוגני ^/$ מרובי-שורות דורשים (?m). ראו regexp/syntax.


דוגמה: סקריפט deploy מותאם

הצוות מריץ ./scripts/deploy.sh דרך Boost. ה-hook שולח רק פלט, לכן נדרש match_output_select בנוסף ל-match_command.

.boost/filters/deploy.toml

schema_version = 1

[filters.deploy]
description = "Keep failures from deploy.sh"
version = "1"
match_command = '(?:^|[;&|]\s*)(?:bash\s+)?(?:\S*/)?deploy\.sh\b'
# The hook pipes output to boost, so select by a distinctive output signature.
# (?m) makes ^ and $ match each line, not only the full output boundaries.
match_output_select = [
  '(?m)^Starting deployment$\n^Environment: ',
]
strip_ansi = true
keep_lines_matching = [
  '^Starting deployment$',
  '^Environment: ',
  '^\[(WARN|ERROR)\]',
  '^ERROR DETAILS:$',
  'failed readiness probe',
  '^File:$',
  '^deploy/check_health\.go:\d+$',
  '^Reason:$',
  '^connection refused',
  '^Rollback started\.\.\.$',
  '^Deployment FAILED$',
]

[[tests.deploy]]
name = "keeps failures, drops info chatter"
input = """
Starting deployment
Environment: staging
[INFO] Waiting for rollout
[WARN] High memory usage detected
[ERROR] Deployment validation failed
ERROR DETAILS:
service payment-service failed readiness probe
File:
deploy/check_health.go:142
Reason:
connection refused to database
Rollback started...
Deployment FAILED
Environment: staging
"""
expected = """
Starting deployment
Environment: staging
[WARN] High memory usage detected
[ERROR] Deployment validation failed
ERROR DETAILS:
service payment-service failed readiness probe
File:
deploy/check_health.go:142
Reason:
connection refused to database
Rollback started...
Deployment FAILED
Environment: staging
"""
Before (raw)
Starting deployment
Environment: staging
[INFO] Waiting for rollout
[WARN] High memory usage detected
[ERROR] Deployment validation failed
ERROR DETAILS:
service payment-service failed readiness probe
File:
deploy/check_health.go:142
Reason:
connection refused to database
Rollback started...
Deployment FAILED
Environment: staging
After Boost filter
Starting deployment
Environment: staging
[WARN] High memory usage detected
[ERROR] Deployment validation failed
ERROR DETAILS:
service payment-service failed readiness probe
File:
deploy/check_health.go:142
Reason:
connection refused to database
Rollback started...
Deployment FAILED
Environment: staging

$ ./scripts/deploy.sh staging # the installed Boost hook pipes output automatically

בדיקות inline

כל בלוק [[tests.<name>]] הוא fixture לרגרסיה: name, input ו-expected. expect_match_output אופציונלי בודק בחירה דרך match_output_select.

איך להריץ

עדיין אין boost filters test. בדקו מסננים מותאמים על ידי pip של פלט לדוגמה דרך boost. Fixtures מובנים רצים עם go test:

# Spot-check a custom filter: pipe sample output through boost
printf '%s\n' 'Starting deployment' 'Environment: staging' '[INFO] noise' | boost

# Built-in [[tests.*]] fixtures run in the Boost repo / CI:
go test ./internal/tomlfilter/ -run TestInlineTestDefs

דוגמה: הסרת רעש make

מסננים מובנים משתמשים באותו סכימה. זה משקף את מסנן make המובנה: מסיר שורות כניסה/יציאה מתיקייה ושורות ריקות.

schema_version = 1

[filters.make]
match_command = "^make\\b"
match_output_select = [
  "^make\\[\\d+\\]:",
  "^gcc ",
]
strip_lines_matching = [
  "^make\\[\\d+\\]:",
  "^\\s*$",
  "^Nothing to be done",
]
on_empty = "make: ok"
Before
make[1]: Entering directory '/home/user/app'
gcc -O2 -c src/main.c
gcc -O2 -o app src/main.o

make[1]: Leaving directory '/home/user/app'
After
gcc -O2 -c src/main.c
gcc -O2 -o app src/main.o

דוגמה: קיצור דרך ב-lint נקי

השתמשו ב-match_output לסיכום שורה אחת כשהכלי הצליח בשקט.

schema_version = 1

[filters.eslint-quiet]
match_command = "^eslint\\b"
match_output_select = [
  "problems",
]
match_output = [
  { pattern = "0 problems", message = "eslint: ok" },
]

השבתת מסנן

עדיף ה-CLI:

boost filters show                 # inventory with enabled/disabled status
boost filters show --enabled       # enabled filters only
boost filters disable git-status   # bare name or toml:builtin:git-status
boost filters enable git-status

או ערכו את ~/.boost/config.toml ישירות — רשמו שמות תחת [filters] disabled. אחרי retrieve_disable_threshold אירועי retrieve (ברירת מחדל 3), boost retrieve מוסיף אוטומטית שמות rollback. 0 מכבה auto-disable.

[filters]
disabled = ["git-status", "make"]
retrieve_disable_threshold = 3

שדות מסנן

שדהסוגמטרה
schema_versionintFile-level schema marker (recommended 1; reserved for future validation)
descriptionstringHuman-readable note (not used at filter runtime)
versionstringCapability version for retrieve / telemetry (e.g. "1")
match_commandstringCommand-path selector: regex against the full command line
match_output_selectstring[]Pipe-path selector: regexes against the complete piped output; use (?m) for line anchors
strip_ansiboolRemove terminal color codes first (before other stages)
replacearrayLine-level regex replacements: { pattern, replacement }
match_outputarrayIf output matches pattern, return message instead (optional unless)
strip_lines_matchingstring[]Drop lines matching any pattern
keep_lines_matchingstring[]Keep only matching lines
dedupe_lines_matchingstring[]Keep the first exact copy of each matching line; drop later identical copies
collapse_lines_matchingarrayReplace matching lines with one summary: { pattern, template }{count} = number of matches
head_lines / tail_linesintKeep first or last N lines
on_emptystringMessage when filtering removes everything

שימו schema_version = 1 בראש כל קובץ. שלבים: strip ANSI → replace → match_output → strip/keep → dedupe → collapse → head/tail → on_empty. רפרנס מלא ב-docs/TOML_FILTERS.md.