@@ -4,7 +4,6 @@ import { parseArgs } from "node:util";
44import { initCommand } from "./commands/init" ;
55import { installCommand } from "./commands/install" ;
66import { listCommand } from "./commands/list" ;
7- import { runPathCommand } from "./commands/path" ;
87import { searchCommand } from "./commands/search" ;
98import { show } from "./commands/show" ;
109import { uninstallCommand } from "./commands/uninstall" ;
@@ -13,10 +12,10 @@ import type { OutputFormat, Scope } from "./types";
1312
1413type CliOptions = {
1514 json : boolean ;
15+ robot : boolean ;
1616 format ?: OutputFormat | undefined ;
1717 local : boolean ;
1818 global : boolean ;
19- name ?: string | undefined ;
2019 source ?: string | undefined ;
2120} ;
2221
@@ -25,19 +24,18 @@ const USAGE = `gitgud <command> [args] [options]
2524Commands:
2625 list
2726 show <name>
28- path <name>
2927 search <query>
3028 install <name>
3129 uninstall <name>
3230 init
3331 update
3432
3533Options:
36- --format Output format: text|json
34+ --format Output format: text|json|robot
3735 --json Output JSON
36+ --robot Robot-friendly output (TSV for list, raw content for show)
3837 --local Use local registry
3938 --global Use global registry
40- --name Skill name (for path)
4139 --source Install source (for install)
4240 -h, --help Show help
4341` ;
@@ -53,9 +51,9 @@ function parseCli(argv: string[]) {
5351 options : {
5452 format : { type : "string" } ,
5553 json : { type : "boolean" } ,
54+ robot : { type : "boolean" } ,
5655 local : { type : "boolean" } ,
5756 global : { type : "boolean" } ,
58- name : { type : "string" } ,
5957 source : { type : "string" } ,
6058 help : { type : "boolean" , short : "h" } ,
6159 } ,
@@ -65,10 +63,10 @@ function parseCli(argv: string[]) {
6563 const help = values . help ?? false ;
6664 const options : CliOptions = {
6765 json : values . json ?? false ,
66+ robot : values . robot ?? false ,
6867 format : ( values . format as OutputFormat | undefined ) ?? undefined ,
6968 local : values . local ?? false ,
7069 global : values . global ?? false ,
71- name : values . name as string | undefined ,
7270 source : values . source as string | undefined ,
7371 } ;
7472
@@ -81,7 +79,7 @@ function parseCli(argv: string[]) {
8179async function dispatch ( command : string , args : string [ ] , options : CliOptions ) : Promise < void > {
8280 switch ( command ) {
8381 case "list" : {
84- const format : OutputFormat = options . format ?? ( options . json ? "json" : "text" ) ;
82+ const format : OutputFormat = options . format ?? ( options . robot ? "robot" : options . json ? "json" : "text" ) ;
8583 listCommand ( {
8684 format,
8785 local : options . local ,
@@ -94,11 +92,6 @@ async function dispatch(command: string, args: string[], options: CliOptions): P
9492 await initCommand ( args , { scope } ) ;
9593 return ;
9694 }
97- case "path" : {
98- const format : OutputFormat = options . format ?? ( options . json ? "json" : "text" ) ;
99- await runPathCommand ( args , { name : options . name , format } ) ;
100- return ;
101- }
10295 case "search" : {
10396 const format : OutputFormat = options . format ?? ( options . json ? "json" : "text" ) ;
10497 await searchCommand ( args , { format } ) ;
@@ -116,15 +109,14 @@ async function dispatch(command: string, args: string[], options: CliOptions): P
116109 case "uninstall" : {
117110 const format : OutputFormat = options . format ?? ( options . json ? "json" : "text" ) ;
118111 uninstallCommand ( args , {
119- name : options . name ,
120112 local : options . local ,
121113 format,
122114 } ) ;
123115 return ;
124116 }
125117 case "show" : {
126118 const name = args [ 0 ] ;
127- const format = options . json ? "json" : "text" ;
119+ const format : OutputFormat = options . format ?? ( options . robot ? "robot" : options . json ? "json" : "text" ) ;
128120 await show ( { name, format } ) ;
129121 return ;
130122 }
0 commit comments