@@ -94,21 +94,23 @@ Notes:
9494
9595- Built-in command candidates cover common cloud tools even before PATH discovery runs.
9696- Built-in tree-shaped subcommands cover common ` git ` , ` docker ` , and ` kubectl ` nested commands even before dynamic discovery runs.
97- - Typo caches discovered subcommands in ` ~/.typo/subcommands.json ` using ` schema_version: 2 ` .
97+ - Typo caches discovered subcommands in ` ~/.typo/subcommands.json ` using ` schema_version: 3 ` .
9898- Hierarchical subcommand discovery is supported for ` git ` , ` docker ` , ` aws ` , ` gcloud ` , and ` az ` ; ` kubectl ` resource correction uses a conservative built-in resource tree.
99- - Older subcommand cache files without ` schema_version: 2 ` are moved aside automatically and regenerated.
99+ - Older subcommand cache files without ` schema_version: 3 ` are moved aside automatically and regenerated.
100100
101- ### Subcommand cache version 2
101+ ### Subcommand cache version 3
102102
103103` subcommands.json ` uses a versioned tree format:
104104
105105``` json
106106{
107- "schema_version" : 2 ,
107+ "schema_version" : 3 ,
108108 "tools" : [
109109 {
110110 "tool" : " git" ,
111111 "tree" : {
112+ "long_options" : [" --help" , " --version" ],
113+ "long_options_with_values" : [" --git-dir" , " --work-tree" ],
112114 "children" : {
113115 "stash" : {
114116 "children" : {
@@ -123,22 +125,26 @@ Notes:
123125}
124126```
125127
126- Version 2 stores nested subcommands directly instead of keeping a flat root list
127- plus path-specific child lists. This lets typo correct each command level
128- independently, for example ` gcloud container clusers lisr ` to
129- ` gcloud container clusters list ` .
128+ Version 3 keeps the nested command tree format and adds long-option metadata to
129+ tree nodes. This lets typo correct each command level independently, for example
130+ ` gcloud container clusers lisr ` to ` gcloud container clusters list ` , while also
131+ keeping the option candidates used by experimental ` --long-option ` correction in
132+ the same cache.
130133
131134Node fields have these meanings:
132135
133136- ` children ` : valid child tokens below the current level
134137- ` terminal ` : the token can end a command path
135138- ` passthrough ` : arguments after this token are treated as user input, not subcommands
136139- ` alias ` : canonical token to output when a short alias is used
137-
138- If typo finds an older cache format, it renames that file to
139- ` subcommands.json.corrupt-<timestamp> ` and rebuilds a fresh version 2 cache on
140- next use. The file only contains discovered command metadata, so no user rules,
141- history, or configuration are lost.
140+ - ` long_options ` : known ` --long-option ` tokens visible at this node
141+ - ` long_options_with_values ` : known ` --long-option ` tokens that consume the next argument
142+
143+ If typo finds an older cache format, including version 2 or files without a
144+ schema version, it renames that file to
145+ ` subcommands.json.corrupt-<timestamp> ` and rebuilds a fresh version 3 cache on
146+ next use. The file only contains discovered command metadata and option
147+ metadata, so no user rules, history, or configuration are lost.
142148
143149## Local files
144150
0 commit comments