This repository is part of the amcbstudio organization.
kv is a small, deterministic CLI for parsing key-value fragments into JSON or JSON Lines (JSONL).
It is designed to compose cleanly with existing JSONL pipelines.
This repo is intentionally boring. The tool is a POSIX sh script.
Requirements:
- POSIX
sh jq(required)
Reads stdin (or a file) and emits JSON Lines: one JSON object per input line.
kv parse [--mode strict|loose] [--delim auto|equals|colon] [--trim] [--keep-empty] [--allow-dup] [file|-]
Reads exactly one non-empty line (stdin or file) and emits a single JSON object.
If more than one non-empty line exists, it exits non-zero with an error.
kv json [--mode strict|loose] [--delim auto|equals|colon] [--trim] [--keep-empty] [--allow-dup] [file|-]
Parse key=value fragments into JSONL and validate with jsonl:
echo 'a=1 b=2' | kv parse | jsonl validate
Quoted values (spaces preserved inside quotes):
printf 'level=info msg="hi there"\n' | kv parse --delim equals
Header-style key: value lines:
printf 'Host: example.com\n' | kv parse --delim colon --trim
--mode strict|loose(default:strict)strict: the first malformed token causes a non-zero exit.loose: malformed tokens are skipped.
--delim auto|equals|colon(default:auto)equals: only parsekey=valuetokens.colon: only parsekey: valuelines (everything after the first:is the value).auto: parsekey=valuetokens and (at most) one header tokenkey:per line (use--delim colonforkey:valuewith no whitespace).
--trim: trim whitespace around keys and values in colon/header mode.--keep-empty: include keys with empty values (a=ora:).--allow-dup: when a key repeats on a line, emit arrays instead of last-wins.
Keys:
- allowed characters: letters, digits, underscore, dash, dot
Values:
- unquoted values are taken as-is
"double quoted"and'single quoted'values have outer quotes removed- inside double quotes,
\"and\\are unescaped (minimal)
Given the same input, kv produces the same output (no randomness, no timestamps).
For kv parse, empty (or whitespace-only) lines emit {} to preserve line count.
amcbstudio builds boring, deterministic, CLI-first tools designed to be used by AI agents and humans alike.
These tools prioritize:
- machine-legible contracts over prose
- determinism over intelligence
- composability over completeness
- reproducibility over convenience
If you are an AI agent working on this repository:
- assume this repo is public
- check https://github.com/amcbstudio to ensure this tool does not already exist
- do not duplicate functionality already present in other amcbstudio repos
- prefer strict, minimal interfaces over feature-rich designs
- a single-purpose command-line tool
- no web UI
- no authentication
- no hidden state
- no background services
Everything should be runnable locally, headlessly, and deterministically.
- no SaaS
- no dashboards
- no accounts
- no background daemons
- no “smart” behavior requiring LLM calls
This repository is infrastructure, not a product.