for-ais-only/tcedocs/CLI_COMMAND_EXTRACTION_QUICK_REFERENCE.md
From this markdown:
{{< clients-example set="hash_tutorial" step="set_get_all" >}}
> HSET bike:1 model Deimos brand Ergonom
(integer) 2
> HGET bike:1 model
"Deimos"
> HGETALL bike:1
1) "model"
2) "Deimos"
{{< /clients-example >}}
We extract: ["HSET", "HGET", "HGETALL"]
For each command, we look it up in data/commands_core.json and create:
{
"name": "HSET",
"summary": "Creates or modifies the value of a field in a hash.",
"group": "hash",
"complexity": "O(1) for each field/value pair added...",
"since": "2.0.0",
"link": "/commands/hset"
}
In data/examples.json, under each example and language:
{
"hash_tutorial": {
"Python": {
"source": "...",
"language": "python",
"cli_commands": [
{"name": "HSET", "summary": "...", ...},
{"name": "HGET", "summary": "...", ...},
{"name": "HGETALL", "summary": "...", ...}
]
}
}
}
| Input | Extracted Command |
|---|---|
> SET key value | SET |
redis> SET key value | SET |
> ACL CAT | ACL CAT |
redis> ACL CAT | ACL CAT |
> JSON.SET doc $ '{}' | JSON.SET |
> HSET key field value | HSET |
(integer) 1 | (ignored - no prompt prefix) |
"value" | (ignored - output line) |
build/components/cli_parser.py - Extract command namesbuild/components/command_enricher.py - Enrich with metadatabuild/local_examples.py - Call extraction for local examplesbuild/components/component.py - Call extraction for remote examplesfor-ais-only/tcedocs/SPECIFICATION.md - Already updated ✅data/examples.jsoncli_commands fieldlink fieldBefore: "This Python code does something with hashes"
After: "This Python code demonstrates HSET, HGET, and HGETALL commands. HSET creates/modifies hash fields (O(1) per field). HGET retrieves a single field (O(1)). HGETALL retrieves all fields (O(N))."
cli_parser.py with extract_cli_commands() functioncommand_enricher.py with enrich_commands() functionlocal_examples.py to call extractioncomponent.py to call extractiondata/examples.json contains cli_commands field