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/CHANGELOG.md +19 -0
- package/CHANGELOG_en.md +19 -0
- package/README.md +31 -5
- package/README_en.md +31 -5
- package/dist/commands/help.js +18 -1
- package/dist/commands/template.d.ts +3 -1
- package/dist/commands/template.js +38 -6
- package/dist/commands/use.js +11 -1
- package/dist/core/manifest.js +10 -1
- package/dist/core/project.js +27 -1
- package/dist/index.js +3 -2
- package/dist/types/config.d.ts +3 -1
- package/dist/types/config.js +4 -2
- package/dist/utils/parsePath.d.ts +1 -1
- package/dist/utils/parsePath.js +5 -3
- package/package.json +1 -1
- package/src/commands/help.ts +18 -1
- package/src/commands/template.ts +202 -160
- package/src/commands/use.ts +11 -1
- package/src/core/manifest.ts +67 -57
- package/src/core/project.ts +304 -276
- package/src/index.ts +254 -253
- package/src/types/config.ts +116 -112
- package/src/utils/parsePath.ts +6 -4
- package/tests/commands/use.test.ts +12 -6
- package/tests/core/project.test.ts +324 -316
- package/tests/types/config.test.ts +44 -16
- package/tests/utils/parsePath.test.ts +18 -9
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
|
-
.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
.
|
|
133
|
-
.
|
|
134
|
-
.option('-
|
|
135
|
-
.option('-
|
|
136
|
-
.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
.
|
|
143
|
-
.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
.
|
|
150
|
-
.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
.
|
|
157
|
-
.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
.
|
|
164
|
-
.
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
.
|
|
171
|
-
.
|
|
172
|
-
.option('--
|
|
173
|
-
.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
.
|
|
181
|
-
.
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
case '
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
case '
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
case '
|
|
213
|
-
case '
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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();
|