tools-cc 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.ts CHANGED
@@ -1,253 +1,254 @@
1
- #!/usr/bin/env node
2
-
3
- import { Command } from 'commander';
4
- import { handleConfigSet, handleConfigGet, handleConfigList } from './commands/config';
5
- import { handleSourceAdd, handleSourceList, handleSourceRemove, handleSourceUpdate, handleSourceScan } from './commands/source';
6
- import { handleUse, handleList, handleRemove, handleStatus, handleProjectUpdate } from './commands/use';
7
- import { handleExport } from './commands/export';
8
- import { handleTemplateSave, handleTemplateList, handleTemplateRemove, handleTemplateUse } from './commands/template';
9
- import { showHelp } from './commands/help';
10
-
11
- const program = new Command();
12
-
13
- program
14
- .name('tools-cc')
15
- .description('CLI tool for managing skills/commands/agents across multiple AI coding tools')
16
- .version('0.0.1');
17
-
18
- // Source management (shortcut options)
19
- program
20
- .option('-s, --source <command> [args...]', 'Source management (shortcut)')
21
- .option('-c, --config <command> [args...]', 'Config management (shortcut)');
22
-
23
- // Source subcommands (full command version)
24
- const sourceCmd = program
25
- .command('sources')
26
- .description('Source management');
27
-
28
- sourceCmd
29
- .command('add <name> <path-or-url>')
30
- .description('Add a source')
31
- .action(async (name: string, pathOrUrl: string) => {
32
- await handleSourceAdd(name, pathOrUrl);
33
- });
34
-
35
- sourceCmd
36
- .command('list')
37
- .alias('ls')
38
- .description('List all sources')
39
- .action(async () => {
40
- await handleSourceList();
41
- });
42
-
43
- sourceCmd
44
- .command('remove <name>')
45
- .alias('rm')
46
- .description('Remove a source')
47
- .action(async (name: string) => {
48
- await handleSourceRemove(name);
49
- });
50
-
51
- sourceCmd
52
- .command('update [name]')
53
- .alias('up')
54
- .alias('upgrade')
55
- .description('Update source(s) with git pull')
56
- .action(async (name?: string) => {
57
- await handleSourceUpdate(name);
58
- });
59
-
60
- sourceCmd
61
- .command('scan')
62
- .description('Scan sources directory and update configuration')
63
- .action(async () => {
64
- await handleSourceScan();
65
- });
66
-
67
- // Config subcommands (full command version)
68
- const configCmd = program
69
- .command('config')
70
- .description('Config management');
71
-
72
- configCmd
73
- .command('set <key> <value>')
74
- .description('Set a config value')
75
- .action(async (key: string, value: string) => {
76
- await handleConfigSet(key, value);
77
- });
78
-
79
- configCmd
80
- .command('get <key>')
81
- .description('Get a config value')
82
- .action(async (key: string) => {
83
- await handleConfigGet(key);
84
- });
85
-
86
- configCmd
87
- .command('list')
88
- .description('Show full configuration')
89
- .action(async () => {
90
- await handleConfigList();
91
- });
92
-
93
- // Template commands
94
- const templateCmd = program
95
- .command('template')
96
- .description('Template management')
97
- .alias('tpl');
98
-
99
- templateCmd
100
- .command('save')
101
- .description('Save current project config as template')
102
- .option('-n, --name <name>', 'Template name (default: project directory name)')
103
- .action(async (options) => {
104
- await handleTemplateSave(options);
105
- });
106
-
107
- templateCmd
108
- .command('list')
109
- .alias('ls')
110
- .description('List all saved templates')
111
- .action(async () => {
112
- await handleTemplateList();
113
- });
114
-
115
- templateCmd
116
- .command('rm <name>')
117
- .description('Remove a template')
118
- .action(async (name: string) => {
119
- await handleTemplateRemove(name);
120
- });
121
-
122
- templateCmd
123
- .command('use [name]')
124
- .description('Apply a template to current project')
125
- .action(async (name?: string) => {
126
- await handleTemplateUse(name);
127
- });
128
-
129
- // Project commands
130
- program
131
- .command('use [sources...]')
132
- .description('Use sources in current project')
133
- .option('-p, --projects <tools...>', 'Tools to link (iflow, claude, codebuddy, opencode, codex)')
134
- .option('-l, --ls', 'Interactive selection mode for single source')
135
- .option('-c, --config <file>', 'Import from config file')
136
- .action(async (sources: string[], options) => {
137
- await handleUse(sources, options);
138
- });
139
-
140
- program
141
- .command('list')
142
- .description('List sources in use')
143
- .action(async () => {
144
- await handleList();
145
- });
146
-
147
- program
148
- .command('rm <source>')
149
- .description('Remove a source from project')
150
- .action(async (source: string) => {
151
- await handleRemove(source);
152
- });
153
-
154
- program
155
- .command('status')
156
- .description('Show project status')
157
- .action(async () => {
158
- await handleStatus();
159
- });
160
-
161
- program
162
- .command('update [sources...]')
163
- .description('Update source(s) in current project')
164
- .action(async (sources: string[]) => {
165
- await handleProjectUpdate(sources);
166
- });
167
-
168
- program
169
- .command('export')
170
- .description('Export project or global config')
171
- .option('-o, --output <file>', 'Output file path')
172
- .option('--global', 'Export global config')
173
- .action(async (options) => {
174
- await handleExport(options);
175
- });
176
-
177
- // Help command
178
- program
179
- .command('help')
180
- .description('Show bilingual help information')
181
- .action(() => {
182
- showHelp();
183
- });
184
-
185
- // Main action handler for -s and -c options
186
- program
187
- .action(async (options) => {
188
- // Handle -s/--source
189
- if (options.source) {
190
- const [cmd, ...args] = options.source;
191
- switch (cmd) {
192
- case 'add':
193
- if (args.length < 2) {
194
- console.log('Usage: tools-cc -s add <name> <path-or-url>');
195
- return;
196
- }
197
- await handleSourceAdd(args[0], args[1]);
198
- break;
199
- case 'list':
200
- case 'ls':
201
- await handleSourceList();
202
- break;
203
- case 'remove':
204
- case 'rm':
205
- if (args.length < 1) {
206
- console.log('Usage: tools-cc -s remove <name>');
207
- return;
208
- }
209
- await handleSourceRemove(args[0]);
210
- break;
211
- case 'update':
212
- case 'up':
213
- case 'upgrade':
214
- await handleSourceUpdate(args[0]);
215
- break;
216
- case 'scan':
217
- await handleSourceScan();
218
- break;
219
- default:
220
- console.log(`Unknown source command: ${cmd}`);
221
- }
222
- return;
223
- }
224
-
225
- // Handle -c/--config
226
- if (options.config) {
227
- const [cmd, ...args] = options.config;
228
- switch (cmd) {
229
- case 'set':
230
- if (args.length < 2) {
231
- console.log('Usage: tools-cc -c set <key> <value>');
232
- return;
233
- }
234
- await handleConfigSet(args[0], args[1]);
235
- break;
236
- case 'get':
237
- if (args.length < 1) {
238
- console.log('Usage: tools-cc -c get <key>');
239
- return;
240
- }
241
- await handleConfigGet(args[0]);
242
- break;
243
- default:
244
- console.log(`Unknown config command: ${cmd}`);
245
- }
246
- return;
247
- }
248
-
249
- // No options provided, show help
250
- program.outputHelp();
251
- });
252
-
253
- program.parseAsync();
1
+ #!/usr/bin/env node
2
+
3
+ import { Command } from 'commander';
4
+ import { handleConfigSet, handleConfigGet, handleConfigList } from './commands/config';
5
+ import { handleSourceAdd, handleSourceList, handleSourceRemove, handleSourceUpdate, handleSourceScan } from './commands/source';
6
+ import { handleUse, handleList, handleRemove, handleStatus, handleProjectUpdate } from './commands/use';
7
+ import { handleExport } from './commands/export';
8
+ import { handleTemplateSave, handleTemplateList, handleTemplateRemove, handleTemplateUse } from './commands/template';
9
+ import { showHelp } from './commands/help';
10
+
11
+ const program = new Command();
12
+
13
+ program
14
+ .name('tools-cc')
15
+ .description('CLI tool for managing skills/commands/agents across multiple AI coding tools')
16
+ .version('0.0.1');
17
+
18
+ // Source management (shortcut options)
19
+ program
20
+ .option('-s, --source <command> [args...]', 'Source management (shortcut)')
21
+ .option('-c, --config <command> [args...]', 'Config management (shortcut)');
22
+
23
+ // Source subcommands (full command version)
24
+ const sourceCmd = program
25
+ .command('sources')
26
+ .description('Source management');
27
+
28
+ sourceCmd
29
+ .command('add <name> <path-or-url>')
30
+ .description('Add a source')
31
+ .action(async (name: string, pathOrUrl: string) => {
32
+ await handleSourceAdd(name, pathOrUrl);
33
+ });
34
+
35
+ sourceCmd
36
+ .command('list')
37
+ .alias('ls')
38
+ .description('List all sources')
39
+ .action(async () => {
40
+ await handleSourceList();
41
+ });
42
+
43
+ sourceCmd
44
+ .command('remove <name>')
45
+ .alias('rm')
46
+ .description('Remove a source')
47
+ .action(async (name: string) => {
48
+ await handleSourceRemove(name);
49
+ });
50
+
51
+ sourceCmd
52
+ .command('update [name]')
53
+ .alias('up')
54
+ .alias('upgrade')
55
+ .description('Update source(s) with git pull')
56
+ .action(async (name?: string) => {
57
+ await handleSourceUpdate(name);
58
+ });
59
+
60
+ sourceCmd
61
+ .command('scan')
62
+ .description('Scan sources directory and update configuration')
63
+ .action(async () => {
64
+ await handleSourceScan();
65
+ });
66
+
67
+ // Config subcommands (full command version)
68
+ const configCmd = program
69
+ .command('config')
70
+ .description('Config management');
71
+
72
+ configCmd
73
+ .command('set <key> <value>')
74
+ .description('Set a config value')
75
+ .action(async (key: string, value: string) => {
76
+ await handleConfigSet(key, value);
77
+ });
78
+
79
+ configCmd
80
+ .command('get <key>')
81
+ .description('Get a config value')
82
+ .action(async (key: string) => {
83
+ await handleConfigGet(key);
84
+ });
85
+
86
+ configCmd
87
+ .command('list')
88
+ .description('Show full configuration')
89
+ .action(async () => {
90
+ await handleConfigList();
91
+ });
92
+
93
+ // Template commands
94
+ const templateCmd = program
95
+ .command('template')
96
+ .description('Template management')
97
+ .alias('tpl');
98
+
99
+ templateCmd
100
+ .command('save')
101
+ .description('Save current project config as template')
102
+ .option('-n, --name <name>', 'Template name (default: project directory name)')
103
+ .action(async (options) => {
104
+ await handleTemplateSave(options);
105
+ });
106
+
107
+ templateCmd
108
+ .command('list')
109
+ .alias('ls')
110
+ .description('List all saved templates')
111
+ .action(async () => {
112
+ await handleTemplateList();
113
+ });
114
+
115
+ templateCmd
116
+ .command('rm <name>')
117
+ .description('Remove a template')
118
+ .action(async (name: string) => {
119
+ await handleTemplateRemove(name);
120
+ });
121
+
122
+ templateCmd
123
+ .command('use [name]')
124
+ .description('Apply a template to current project')
125
+ .option('-p, --projects <tools...>', 'Tools to link (iflow, claude, codebuddy, opencode, codex)')
126
+ .action(async (name: string | undefined, options) => {
127
+ await handleTemplateUse(name, options);
128
+ });
129
+
130
+ // Project commands
131
+ program
132
+ .command('use [sources...]')
133
+ .description('Use sources in current project')
134
+ .option('-p, --projects <tools...>', 'Tools to link (iflow, claude, codebuddy, opencode, codex)')
135
+ .option('-l, --ls', 'Interactive selection mode for single source')
136
+ .option('-c, --config <file>', 'Import from config file')
137
+ .action(async (sources: string[], options) => {
138
+ await handleUse(sources, options);
139
+ });
140
+
141
+ program
142
+ .command('list')
143
+ .description('List sources in use')
144
+ .action(async () => {
145
+ await handleList();
146
+ });
147
+
148
+ program
149
+ .command('rm <source>')
150
+ .description('Remove a source from project')
151
+ .action(async (source: string) => {
152
+ await handleRemove(source);
153
+ });
154
+
155
+ program
156
+ .command('status')
157
+ .description('Show project status')
158
+ .action(async () => {
159
+ await handleStatus();
160
+ });
161
+
162
+ program
163
+ .command('update [sources...]')
164
+ .description('Update source(s) in current project')
165
+ .action(async (sources: string[]) => {
166
+ await handleProjectUpdate(sources);
167
+ });
168
+
169
+ program
170
+ .command('export')
171
+ .description('Export project or global config')
172
+ .option('-o, --output <file>', 'Output file path')
173
+ .option('--global', 'Export global config')
174
+ .action(async (options) => {
175
+ await handleExport(options);
176
+ });
177
+
178
+ // Help command
179
+ program
180
+ .command('help')
181
+ .description('Show bilingual help information')
182
+ .action(() => {
183
+ showHelp();
184
+ });
185
+
186
+ // Main action handler for -s and -c options
187
+ program
188
+ .action(async (options) => {
189
+ // Handle -s/--source
190
+ if (options.source) {
191
+ const [cmd, ...args] = options.source;
192
+ switch (cmd) {
193
+ case 'add':
194
+ if (args.length < 2) {
195
+ console.log('Usage: tools-cc -s add <name> <path-or-url>');
196
+ return;
197
+ }
198
+ await handleSourceAdd(args[0], args[1]);
199
+ break;
200
+ case 'list':
201
+ case 'ls':
202
+ await handleSourceList();
203
+ break;
204
+ case 'remove':
205
+ case 'rm':
206
+ if (args.length < 1) {
207
+ console.log('Usage: tools-cc -s remove <name>');
208
+ return;
209
+ }
210
+ await handleSourceRemove(args[0]);
211
+ break;
212
+ case 'update':
213
+ case 'up':
214
+ case 'upgrade':
215
+ await handleSourceUpdate(args[0]);
216
+ break;
217
+ case 'scan':
218
+ await handleSourceScan();
219
+ break;
220
+ default:
221
+ console.log(`Unknown source command: ${cmd}`);
222
+ }
223
+ return;
224
+ }
225
+
226
+ // Handle -c/--config
227
+ if (options.config) {
228
+ const [cmd, ...args] = options.config;
229
+ switch (cmd) {
230
+ case 'set':
231
+ if (args.length < 2) {
232
+ console.log('Usage: tools-cc -c set <key> <value>');
233
+ return;
234
+ }
235
+ await handleConfigSet(args[0], args[1]);
236
+ break;
237
+ case 'get':
238
+ if (args.length < 1) {
239
+ console.log('Usage: tools-cc -c get <key>');
240
+ return;
241
+ }
242
+ await handleConfigGet(args[0]);
243
+ break;
244
+ default:
245
+ console.log(`Unknown config command: ${cmd}`);
246
+ }
247
+ return;
248
+ }
249
+
250
+ // No options provided, show help
251
+ program.outputHelp();
252
+ });
253
+
254
+ program.parseAsync();