@fidel-tools/validate-pack
v0.1.6
Published
Validation tool for Fidel Tools language packs
Downloads
464
Maintainers
Readme
@fidel-tools/validate-pack
The automated CLI validation and linting tool for verifying schema correctness, duplicate rules, and cyclic maps in Fidel Tools language packs.
Features
- Schema Check: Ensures language pack JSON files conform to the
LanguagePackTypeScript interface. - Cycle Detection: Analyzes character mappings (
char_map,labialized_map) to identify circular references (e.g.A -> B -> A) that would lead to infinite loops. - Consistency Enforcement: Checks that protected words are not flagged as stopwords.
- Clean Rule Lists: Detects duplicates in prefix, suffix, and stopword arrays.
- Auto-Fix Flag: Includes a
--fixoption to automatically deduplicate arrays and resolve configuration overlaps.
Installation
pnpm add -g @fidel-tools/validate-packCLI Usage
Run Validation
Check your language pack config:
validate-pack ./path/to/am.jsonRun Auto-Fix
Automatically resolve duplicates and overlaps in the JSON pack:
validate-pack --fix ./path/to/am.jsonProgrammatic API
import { validatePack, fixPack } from '@fidel-tools/validate-pack'
import amPack from '@fidel-tools/lang-am'
// Validate pack
const result = validatePack(amPack)
console.log(result.isValid) // true
// Fix pack
const { fixedPack, fixedCount } = fixPack(amPack)