elastic / elastic/detection-rules-explorer
[FR] Cleanup and Refactor
- Dominant language
- TypeScript
- Stars
- 22
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
This issue is to track some clean up/refactoring that should be done if we want to continue to use this repo for reference for rules, hunts, etc.
Proposed updates are along these lines:
Current behavior:
```
parseRuleData.ts ──tsc──▶ .prebuild/parseRuleData.js ──node──▶ src/data/
├── rules/.json (1787 files)
├── newestRules.json (summary list)
└── tagSummaries.json (tag → count)
```
Intended behavior after changes:
```
scripts/prebuild/
index.ts orchestration, exit codes, structured summary log
fetch_rules.ts tarball download (+ GITHUB_TOKEN), tar entry filtering
normalize_rule.ts PURE: defaults, tag synthesis, convertHuntMitre ← unit-tested
summarize.ts tag counting, sort orders ← unit-tested
write_output.ts output paths, stale-file clearing, fs writes
types.ts re-exports the shared RuleSummary / TagSummary
__fixtures__/ one detection-rule TOML, one hunting TOML
│
│ tsc -p tsconfig.scripts.json
▼
.prebuild/scripts/prebuild/index.js (+ sibling modules; gitignored)
│
│ node — reads GITHUB_TOKEN if set; exits 1 on parse failures
│ or if fewer than MIN_RULES (~1000) were parsed
▼
src/data/ cleared first, then rewritten (gitignored)
├── rules/.json one file per rule, unchanged shape
├── newestRules.json summaries, sorted by updated_date desc
└── tagSummaries.json tag → count, sorted by count desc
```
Task list:
- [ ] CI Guardrails
- [ ] Cleanup Dead Code
- [ ] Simplify Rule Taxonomy and Rule Types Definitions
- [ ] Update Rendering
- [ ] Update toolchain
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.