# a-text (adapter system)

Text/string capability pack: 80 pure string utilities — case conversion, base64, digests (MD5/SHA-1/SHA-256/SHA-512/HMAC/CRC-32), classical ciphers (Caesar/ROT13/Vigenère/Atbash/Morse), extraction...


Text/string **capability pack**. Ported from `leumas-middleware/lib/a.text` — the pure core: 80
string utilities (69 migrated + 11 added digests/ciphers). Stripped: express `server.mjs`,
`frontend/`, `scripts/`, `queue.csv`, and the 750-line `hieroglyphics` novelty adapter (glyph
cipher) which is out of scope for a lightweight port.

Each source utility (`module.exports = (text, options) => …` or `export const commit = …`) is folded
into `index.js` as a named function; `adapters[<name>] = (args) => fn(primaryInput, args)` where the
primary input is resolved from `args.text ?? args.input ?? args.value ?? args.string ?? args`.

Source note: the port fixes one genuine bug — `UnescapeHTML` had an invalid string literal
(`.replace(/&#039;/g, ''')`) corrected to replace with a proper apostrophe.

## Tools (`adapters`)

80 utilities, e.g.:

| tool | args | result |
|------|------|--------|
| `uppercase` / `lowercase` | `{ text }` | cased string |
| `Base64Encode` / `Base64Decode` | `{ text }` | encoded/decoded string |
| `MD5Hash` / `SHA1Hash` / `SHA256Hash` / `SHA512Hash` | `{ text }` | hex digest (uses `node:crypto`) |
| `HMAC` | `{ text, key, algorithm? }` | hex HMAC (default `sha256`; throws without `key`) |
| `CRC32` | `{ text, output? }` | CRC-32 as hex (default) or `uint` |
| `SnakeCase` / `KebabCase` / `CamelCase` / `PascalCase` / `TitleCase` | `{ text }` | recased string |
| `ExtractEmails` / `ExtractURLs` / `ExtractHashtags` / `ExtractMentions` | `{ text }` | array of matches |
| `Truncate` | `{ text, length }` | truncated string |
| `countWords` / `CountCharacters` | `{ text }` | count |
| `redactSensitiveInfo` / `readabilityScore` / `StemWords` / `RemoveStopWords` | `{ text }` | processed text |

### Classical ciphers

| tool | args | result |
|------|------|--------|
| `CaesarCipher` | `{ text, shift? }` | letters shifted by `shift` (default 3), case/non-letters preserved |
| `Rot13` | `{ text }` | Caesar shift 13 |
| `VigenereEncode` / `VigenereDecode` | `{ text, key }` | keyword cipher over letters (throws without `key`) |
| `Atbash` | `{ text }` | mirrored alphabet (a<->z) |
| `MorseEncode` / `MorseDecode` | `{ text }` | Morse code (` ` between letters, ` / ` between words) |

Others: capitalizeFirstLetter, codePointAt, concat, correctTypos, endsWith, EscapeHTML, FindAndReplace,
fromCharCode, fromCodePoint, includes, indexOf, joinLines, JSONParse, JSONStringify, lastIndexOf,
length, LevenshteinDistance, localeCompare, normalize, pad/padEnd/padStart, RemoveDuplicates/Emojis/
Numbers/Punctuation/Whitespace, removeNonAlphanumeric, repeat, replace, reverse, reverseWords,
ShuffleWords, slice, SortLines, splitLines, splitWords, startsWith, StripHTML, substr, substring,
SwapCase, toNumber, trim/trimEnd/trimStart, UnescapeHTML.

Non-string inputs pass through unchanged (source behavior preserved).


---
Source: shared/engines/adapters/domain/a-text/README.md
Canonical: https://docs.leumas.tech/p/adapters/domain/a-text
