mcpick 0.0.18 → 0.0.19

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.
Files changed (77) hide show
  1. package/.vscode/settings.json +5 -0
  2. package/CHANGELOG.md +7 -0
  3. package/dist/add-B9nVyh8T.js +113 -0
  4. package/dist/add-json-CXNDl3al.js +58 -0
  5. package/dist/atomic-write-BqEykHp9.js +26 -0
  6. package/dist/backup-DSDhHI5f.js +64 -0
  7. package/dist/cache-D6kd7qE8.js +226 -0
  8. package/dist/claude-cli-BeA-bmoW.js +394 -0
  9. package/dist/cli-DNNZjJYL.js +84 -0
  10. package/dist/clone-DLFLewBY.js +88 -0
  11. package/dist/config-DijVdEFn.js +176 -0
  12. package/dist/dev-DRJRNp7y.js +265 -0
  13. package/dist/disable-BA8tXPJN.js +39 -0
  14. package/dist/enable-Bdnnn_Cq.js +40 -0
  15. package/dist/get-BPjMXTMc.js +41 -0
  16. package/dist/hook-state-Di8lUsPr.js +171 -0
  17. package/dist/hooks-Bmn7pUZa.js +280 -0
  18. package/dist/index.js +1230 -305
  19. package/dist/list-B8YeDWt6.js +64 -0
  20. package/dist/marketplace-Br89Tg-Z.js +168 -0
  21. package/dist/output-BchYq0mR.js +15 -0
  22. package/dist/paths-BPISiJi4.js +124 -0
  23. package/dist/plugin-cache-Bby9Dxm9.js +405 -0
  24. package/dist/plugins-DHYJF5CP.js +212 -0
  25. package/dist/profile-CX97sMGp.js +120 -0
  26. package/dist/profile-DkY_lBEm.js +70 -0
  27. package/dist/redact-O35tjnRD.js +26 -0
  28. package/dist/registry-CfUKT7_C.js +92 -0
  29. package/dist/reload-CYDhkCVZ.js +31 -0
  30. package/dist/remove-DIPWYMpk.js +31 -0
  31. package/dist/reset-project-choices-DRM5KByw.js +28 -0
  32. package/dist/restore-DdMfUljI.js +84 -0
  33. package/dist/rolldown-runtime-CiIaOW0V.js +13 -0
  34. package/dist/settings-DEcWtzLE.js +201 -0
  35. package/dist/validation-xMlbgGCF.js +44 -0
  36. package/package.json +20 -19
  37. package/dist/cli/commands/add-json.js +0 -60
  38. package/dist/cli/commands/add.js +0 -135
  39. package/dist/cli/commands/backup.js +0 -83
  40. package/dist/cli/commands/cache.js +0 -296
  41. package/dist/cli/commands/clone.js +0 -108
  42. package/dist/cli/commands/dev.js +0 -167
  43. package/dist/cli/commands/disable.js +0 -36
  44. package/dist/cli/commands/enable.js +0 -39
  45. package/dist/cli/commands/get.js +0 -45
  46. package/dist/cli/commands/hooks.js +0 -314
  47. package/dist/cli/commands/list.js +0 -64
  48. package/dist/cli/commands/marketplace.js +0 -211
  49. package/dist/cli/commands/plugins.js +0 -265
  50. package/dist/cli/commands/profile.js +0 -134
  51. package/dist/cli/commands/reload.js +0 -36
  52. package/dist/cli/commands/remove.js +0 -35
  53. package/dist/cli/commands/reset-project-choices.js +0 -32
  54. package/dist/cli/commands/restore.js +0 -105
  55. package/dist/cli/index.js +0 -29
  56. package/dist/cli/output.js +0 -21
  57. package/dist/commands/add-server.js +0 -310
  58. package/dist/commands/backup.js +0 -60
  59. package/dist/commands/edit-config.js +0 -109
  60. package/dist/commands/edit-plugins.js +0 -201
  61. package/dist/commands/manage-cache.js +0 -155
  62. package/dist/commands/manage-hooks.js +0 -99
  63. package/dist/commands/manage-marketplace.js +0 -293
  64. package/dist/commands/restore.js +0 -118
  65. package/dist/core/config.js +0 -200
  66. package/dist/core/dev-override.js +0 -155
  67. package/dist/core/hook-state.js +0 -220
  68. package/dist/core/plugin-cache.js +0 -506
  69. package/dist/core/profile.js +0 -94
  70. package/dist/core/registry.js +0 -121
  71. package/dist/core/settings.js +0 -243
  72. package/dist/core/validation.js +0 -49
  73. package/dist/types.js +0 -2
  74. package/dist/utils/atomic-write.js +0 -27
  75. package/dist/utils/claude-cli.js +0 -485
  76. package/dist/utils/paths.js +0 -114
  77. package/dist/utils/redact.js +0 -28
@@ -1,314 +0,0 @@
1
- import { defineCommand } from 'citty';
2
- import { check_restored_hooks, disable_plugin_hook, enable_plugin_hook, read_disabled_hooks, redisable_restored_hooks, } from '../../core/hook-state.js';
3
- import { add_hook, get_all_hooks, remove_hook, } from '../../core/settings.js';
4
- import { error, output } from '../output.js';
5
- const list = defineCommand({
6
- meta: {
7
- name: 'list',
8
- description: 'List all configured hooks (settings + plugins + disabled)',
9
- },
10
- args: {
11
- scope: {
12
- type: 'string',
13
- description: 'Filter by source: user, project, project-local, or plugin',
14
- },
15
- json: {
16
- type: 'boolean',
17
- description: 'Output as JSON',
18
- default: false,
19
- },
20
- },
21
- async run({ args }) {
22
- const hooks = await get_all_hooks();
23
- const disabled = await read_disabled_hooks();
24
- const filtered = args.scope
25
- ? hooks.filter((h) => h.source === args.scope || h.scope === args.scope)
26
- : hooks;
27
- if (args.json) {
28
- output({ active: filtered, disabled }, true);
29
- }
30
- else {
31
- if (filtered.length === 0 && disabled.length === 0) {
32
- console.log('No hooks configured.');
33
- return;
34
- }
35
- if (filtered.length > 0) {
36
- for (let i = 0; i < filtered.length; i++) {
37
- const h = filtered[i];
38
- const detail = h.handler.command ||
39
- h.handler.url ||
40
- h.handler.prompt ||
41
- '(unknown)';
42
- const matcher_str = h.matcher ? ` [${h.matcher}]` : '';
43
- const source = h.source === 'plugin'
44
- ? `plugin: ${h.plugin_key}`
45
- : h.scope;
46
- console.log(`${i}: [${source}] ${h.event}${matcher_str} → ${h.handler.type}: ${detail}`);
47
- }
48
- }
49
- if (disabled.length > 0) {
50
- console.log('\nDisabled:');
51
- for (let i = 0; i < disabled.length; i++) {
52
- const d = disabled[i];
53
- const detail = d.original_handler.command ||
54
- d.original_handler.url ||
55
- d.original_handler.prompt ||
56
- '(unknown)';
57
- const matcher_str = d.matcher ? ` [${d.matcher}]` : '';
58
- console.log(`${i}: [${d.plugin_key}] ${d.event}${matcher_str} → ${d.original_handler.type}: ${detail}`);
59
- }
60
- }
61
- }
62
- },
63
- });
64
- const disable = defineCommand({
65
- meta: {
66
- name: 'disable',
67
- description: 'Disable a hook by index (use "hooks list" to see indices)',
68
- },
69
- args: {
70
- index: {
71
- type: 'positional',
72
- description: 'Hook index from "hooks list" (0-based)',
73
- required: true,
74
- },
75
- json: {
76
- type: 'boolean',
77
- description: 'Output as JSON',
78
- default: false,
79
- },
80
- },
81
- async run({ args }) {
82
- const hooks = await get_all_hooks();
83
- const idx = parseInt(args.index, 10);
84
- if (isNaN(idx) || idx < 0 || idx >= hooks.length) {
85
- error(`Invalid index: ${args.index}. Run "mcpick hooks list" to see available hooks (0-${hooks.length - 1}).`);
86
- }
87
- const entry = hooks[idx];
88
- if (entry.source === 'plugin') {
89
- await disable_plugin_hook(entry);
90
- if (args.json) {
91
- output({
92
- disabled: true,
93
- event: entry.event,
94
- plugin_key: entry.plugin_key,
95
- }, true);
96
- }
97
- else {
98
- console.log(`Disabled: ${entry.event} from ${entry.plugin_key}`);
99
- console.log('Restart Claude Code for changes to take effect.');
100
- }
101
- }
102
- else {
103
- // Settings hook — remove it
104
- await remove_hook(entry);
105
- if (args.json) {
106
- output({
107
- removed: true,
108
- event: entry.event,
109
- scope: entry.scope,
110
- }, true);
111
- }
112
- else {
113
- console.log(`Removed: ${entry.event} (${entry.scope})`);
114
- }
115
- }
116
- },
117
- });
118
- const enable = defineCommand({
119
- meta: {
120
- name: 'enable',
121
- description: 'Re-enable a disabled hook by index (use "hooks list" to see disabled hooks)',
122
- },
123
- args: {
124
- index: {
125
- type: 'positional',
126
- description: 'Disabled hook index from "hooks list" (0-based)',
127
- required: true,
128
- },
129
- json: {
130
- type: 'boolean',
131
- description: 'Output as JSON',
132
- default: false,
133
- },
134
- },
135
- async run({ args }) {
136
- const disabled = await read_disabled_hooks();
137
- const idx = parseInt(args.index, 10);
138
- if (isNaN(idx) || idx < 0 || idx >= disabled.length) {
139
- error(`Invalid index: ${args.index}. Run "mcpick hooks list" to see disabled hooks (0-${disabled.length - 1}).`);
140
- }
141
- const entry = disabled[idx];
142
- await enable_plugin_hook(entry);
143
- if (args.json) {
144
- output({
145
- enabled: true,
146
- event: entry.event,
147
- plugin_key: entry.plugin_key,
148
- }, true);
149
- }
150
- else {
151
- console.log(`Re-enabled: ${entry.event} for ${entry.plugin_key}`);
152
- console.log('Restart Claude Code for changes to take effect.');
153
- }
154
- },
155
- });
156
- const add = defineCommand({
157
- meta: {
158
- name: 'add',
159
- description: 'Add a new settings-based hook',
160
- },
161
- args: {
162
- event: {
163
- type: 'positional',
164
- description: 'Hook event type (e.g. UserPromptSubmit, PreToolUse)',
165
- required: true,
166
- },
167
- handler_type: {
168
- type: 'positional',
169
- description: 'Handler type: command, prompt, http, or agent',
170
- required: true,
171
- },
172
- value: {
173
- type: 'positional',
174
- description: 'Handler value (command string, prompt text, URL, or agent prompt)',
175
- required: true,
176
- },
177
- matcher: {
178
- type: 'string',
179
- description: 'Matcher pattern (e.g. Bash, Edit|Write) — only for tool/session events',
180
- },
181
- scope: {
182
- type: 'string',
183
- description: 'Scope: user, project, or project-local (default: user)',
184
- default: 'user',
185
- },
186
- json: {
187
- type: 'boolean',
188
- description: 'Output as JSON',
189
- default: false,
190
- },
191
- },
192
- async run({ args }) {
193
- const scope = args.scope;
194
- if (!['user', 'project', 'project-local'].includes(scope)) {
195
- error(`Invalid scope: ${scope}. Use user, project, or project-local.`);
196
- }
197
- const handler_type = args.handler_type;
198
- if (!['command', 'prompt', 'http', 'agent'].includes(handler_type)) {
199
- error(`Invalid handler type: ${handler_type}. Use command, prompt, http, or agent.`);
200
- }
201
- const handler = { type: handler_type };
202
- if (handler_type === 'command')
203
- handler.command = args.value;
204
- else if (handler_type === 'prompt')
205
- handler.prompt = args.value;
206
- else if (handler_type === 'http')
207
- handler.url = args.value;
208
- else if (handler_type === 'agent')
209
- handler.prompt = args.value;
210
- await add_hook(scope, args.event, args.matcher || undefined, handler);
211
- if (args.json) {
212
- output({
213
- added: true,
214
- event: args.event,
215
- handler_type,
216
- scope,
217
- matcher: args.matcher || null,
218
- }, true);
219
- }
220
- else {
221
- console.log(`Hook added: ${args.event} → ${handler_type} (${scope})`);
222
- }
223
- },
224
- });
225
- const remove = defineCommand({
226
- meta: {
227
- name: 'remove',
228
- description: 'Remove a settings hook by index (use "hooks list" to see indices)',
229
- },
230
- args: {
231
- index: {
232
- type: 'positional',
233
- description: 'Hook index from "hooks list" (0-based)',
234
- required: true,
235
- },
236
- json: {
237
- type: 'boolean',
238
- description: 'Output as JSON',
239
- default: false,
240
- },
241
- },
242
- async run({ args }) {
243
- const hooks = await get_all_hooks();
244
- const settings_hooks = hooks.filter((h) => h.source !== 'plugin');
245
- const idx = parseInt(args.index, 10);
246
- if (isNaN(idx) || idx < 0 || idx >= settings_hooks.length) {
247
- error(`Invalid index: ${args.index}. Use "mcpick hooks list" to see settings hooks.`);
248
- }
249
- const entry = settings_hooks[idx];
250
- await remove_hook(entry);
251
- if (args.json) {
252
- output({
253
- removed: true,
254
- event: entry.event,
255
- scope: entry.scope,
256
- }, true);
257
- }
258
- else {
259
- const detail = entry.handler.command ||
260
- entry.handler.url ||
261
- entry.handler.prompt ||
262
- '(unknown)';
263
- console.log(`Removed: [${entry.scope}] ${entry.event} → ${entry.handler.type}: ${detail}`);
264
- }
265
- },
266
- });
267
- const check = defineCommand({
268
- meta: {
269
- name: 'check',
270
- description: 'Check if marketplace updates restored any disabled hooks',
271
- },
272
- args: {
273
- fix: {
274
- type: 'boolean',
275
- description: 'Automatically re-disable restored hooks',
276
- default: false,
277
- },
278
- json: {
279
- type: 'boolean',
280
- description: 'Output as JSON',
281
- default: false,
282
- },
283
- },
284
- async run({ args }) {
285
- const restored = await check_restored_hooks();
286
- if (args.json) {
287
- output({ restored: restored.length, hooks: restored }, true);
288
- return;
289
- }
290
- if (restored.length === 0) {
291
- console.log('No disabled hooks were restored. All good.');
292
- return;
293
- }
294
- console.log(`${restored.length} disabled hook(s) were restored:`);
295
- for (const r of restored) {
296
- console.log(` ${r.plugin_key}: ${r.event}`);
297
- }
298
- if (args.fix) {
299
- const result = await redisable_restored_hooks(restored);
300
- console.log(`Re-disabled ${result.success} hook(s).${result.failed > 0 ? ` Failed: ${result.failed}` : ''}`);
301
- }
302
- else {
303
- console.log('Run with --fix to re-disable, or use "mcpick hooks disable".');
304
- }
305
- },
306
- });
307
- export default defineCommand({
308
- meta: {
309
- name: 'hooks',
310
- description: 'Manage hooks (settings + plugin). Disable individual plugin hooks, add/remove settings hooks.',
311
- },
312
- subCommands: { list, disable, enable, add, remove, check },
313
- });
314
- //# sourceMappingURL=hooks.js.map
@@ -1,64 +0,0 @@
1
- import { defineCommand } from 'citty';
2
- import { get_enabled_servers_for_scope } from '../../core/config.js';
3
- import { get_all_available_servers } from '../../core/registry.js';
4
- import { redact_server } from '../../utils/redact.js';
5
- import { error, output } from '../output.js';
6
- export default defineCommand({
7
- meta: {
8
- name: 'list',
9
- description: 'List all MCP servers and their status',
10
- },
11
- args: {
12
- scope: {
13
- type: 'string',
14
- description: 'Scope to check: local, project, or user',
15
- },
16
- json: {
17
- type: 'boolean',
18
- description: 'Output as JSON',
19
- default: false,
20
- },
21
- },
22
- async run({ args }) {
23
- const scopes = args.scope
24
- ? [args.scope]
25
- : ['local', 'project', 'user'];
26
- if (args.scope &&
27
- !['local', 'project', 'user'].includes(args.scope)) {
28
- error(`Invalid scope: ${args.scope}. Use local, project, or user.`);
29
- }
30
- const all_servers = await get_all_available_servers();
31
- const enabled_by_scope = {};
32
- for (const scope of scopes) {
33
- enabled_by_scope[scope] =
34
- await get_enabled_servers_for_scope(scope);
35
- }
36
- if (args.json) {
37
- const data = all_servers.map((server) => {
38
- const status = {};
39
- for (const scope of scopes) {
40
- status[scope] = enabled_by_scope[scope].includes(server.name);
41
- }
42
- const { name, ...rest } = redact_server(server);
43
- return { name, ...status, ...rest };
44
- });
45
- output(data, true);
46
- }
47
- else {
48
- if (all_servers.length === 0) {
49
- console.log('No servers in registry.');
50
- return;
51
- }
52
- for (const server of all_servers) {
53
- const statuses = scopes
54
- .map((scope) => {
55
- const enabled = enabled_by_scope[scope].includes(server.name);
56
- return `${scope}:${enabled ? 'on' : 'off'}`;
57
- })
58
- .join(' ');
59
- console.log(`${server.name} ${statuses}`);
60
- }
61
- }
62
- },
63
- });
64
- //# sourceMappingURL=list.js.map
@@ -1,211 +0,0 @@
1
- import { defineCommand } from 'citty';
2
- import { check_restored_hooks, redisable_restored_hooks, } from '../../core/hook-state.js';
3
- import { read_marketplace_manifest } from '../../core/plugin-cache.js';
4
- import { marketplace_add_via_cli, marketplace_list_via_cli, marketplace_remove_via_cli, marketplace_update_via_cli, } from '../../utils/claude-cli.js';
5
- import { error, output } from '../output.js';
6
- const list = defineCommand({
7
- meta: {
8
- name: 'list',
9
- description: 'List configured marketplaces',
10
- },
11
- args: {
12
- json: {
13
- type: 'boolean',
14
- description: 'Output as JSON',
15
- default: false,
16
- },
17
- },
18
- async run({ args }) {
19
- const result = await marketplace_list_via_cli();
20
- if (!result.success) {
21
- error(result.error || 'Unknown error');
22
- }
23
- if (args.json) {
24
- // Try to parse CLI JSON output, fallback to raw
25
- try {
26
- const parsed = JSON.parse(result.stdout || '[]');
27
- output(parsed, true);
28
- }
29
- catch {
30
- output({ marketplaces: result.stdout }, true);
31
- }
32
- }
33
- else {
34
- console.log(result.stdout || 'No marketplaces configured.');
35
- }
36
- },
37
- });
38
- const add = defineCommand({
39
- meta: {
40
- name: 'add',
41
- description: 'Add a plugin marketplace (a catalog of installable plugins)',
42
- },
43
- args: {
44
- source: {
45
- type: 'positional',
46
- description: 'Marketplace source (GitHub repo, URL, or local path)',
47
- required: true,
48
- },
49
- json: {
50
- type: 'boolean',
51
- description: 'Output as JSON',
52
- default: false,
53
- },
54
- },
55
- async run({ args }) {
56
- const result = await marketplace_add_via_cli(args.source);
57
- if (args.json) {
58
- // Try to include available plugins in JSON output
59
- let available_plugins = [];
60
- if (result.success) {
61
- const manifests = await find_marketplace_plugins(args.source);
62
- available_plugins = manifests;
63
- }
64
- output({
65
- added: args.source,
66
- success: result.success,
67
- error: result.error,
68
- available_plugins,
69
- }, true);
70
- }
71
- else if (result.success) {
72
- console.log(`Marketplace added: ${args.source}`);
73
- await show_available_plugins(args.source);
74
- }
75
- else {
76
- error(result.error || 'Unknown error');
77
- }
78
- },
79
- });
80
- /**
81
- * Try to find and display available plugins from a newly added marketplace.
82
- * The marketplace name in the filesystem may differ from the source string,
83
- * so we try common derivations.
84
- */
85
- async function find_marketplace_plugins(source) {
86
- // Try the source as-is, then extract repo name from various formats
87
- const candidates = [];
88
- // Extract repo name from owner/repo, URLs, etc.
89
- const repo_match = source.match(/([^/]+?)(?:\.git)?$/);
90
- if (repo_match) {
91
- candidates.push(repo_match[1].toLowerCase());
92
- candidates.push(repo_match[1]);
93
- }
94
- // Try the full source as a name
95
- candidates.push(source);
96
- for (const name of candidates) {
97
- const manifest = await read_marketplace_manifest(name);
98
- if (manifest?.plugins?.length) {
99
- return manifest.plugins.map((p) => {
100
- const desc = p.description
101
- ? ` - ${p.description}`
102
- : '';
103
- return `${p.name}${desc}`;
104
- });
105
- }
106
- }
107
- return [];
108
- }
109
- async function show_available_plugins(source) {
110
- const plugins = await find_marketplace_plugins(source);
111
- if (plugins.length > 0) {
112
- console.log(`\nAvailable plugins (${plugins.length}):`);
113
- for (const p of plugins) {
114
- console.log(` - ${p}`);
115
- }
116
- console.log('\nInstall with: mcpick plugins install <name>@<marketplace>');
117
- }
118
- else {
119
- console.log('\nTo browse and install plugins: mcpick plugins install <name>@<marketplace>');
120
- }
121
- }
122
- const remove = defineCommand({
123
- meta: {
124
- name: 'remove',
125
- description: 'Remove a marketplace',
126
- },
127
- args: {
128
- name: {
129
- type: 'positional',
130
- description: 'Marketplace name to remove',
131
- required: true,
132
- },
133
- json: {
134
- type: 'boolean',
135
- description: 'Output as JSON',
136
- default: false,
137
- },
138
- },
139
- async run({ args }) {
140
- const result = await marketplace_remove_via_cli(args.name);
141
- if (args.json) {
142
- output({
143
- removed: args.name,
144
- success: result.success,
145
- error: result.error,
146
- }, true);
147
- }
148
- else if (result.success) {
149
- console.log(`Marketplace removed: ${args.name}`);
150
- }
151
- else {
152
- error(result.error || 'Unknown error');
153
- }
154
- },
155
- });
156
- const update = defineCommand({
157
- meta: {
158
- name: 'update',
159
- description: 'Update marketplace(s) from source',
160
- },
161
- args: {
162
- name: {
163
- type: 'positional',
164
- description: 'Marketplace name to update (omit to update all)',
165
- required: false,
166
- },
167
- json: {
168
- type: 'boolean',
169
- description: 'Output as JSON',
170
- default: false,
171
- },
172
- },
173
- async run({ args }) {
174
- const result = await marketplace_update_via_cli(args.name || undefined);
175
- if (args.json) {
176
- output({
177
- updated: args.name || 'all',
178
- success: result.success,
179
- error: result.error,
180
- }, true);
181
- }
182
- else if (result.success) {
183
- console.log(args.name
184
- ? `Marketplace updated: ${args.name}`
185
- : 'All marketplaces updated.');
186
- // Check if update restored any disabled hooks
187
- const restored = await check_restored_hooks();
188
- if (restored.length > 0) {
189
- console.log(`\nWarning: ${restored.length} disabled hook(s) were restored by the update.`);
190
- const redisable_result = await redisable_restored_hooks(restored);
191
- console.log(`Re-disabled ${redisable_result.success} hook(s).${redisable_result.failed > 0 ? ` Failed: ${redisable_result.failed}` : ''}`);
192
- }
193
- }
194
- else {
195
- error(result.error || 'Unknown error');
196
- }
197
- },
198
- });
199
- export default defineCommand({
200
- meta: {
201
- name: 'marketplace',
202
- description: 'Manage plugin marketplaces (catalogs of installable plugins). Add a marketplace first, then install plugins from it with: mcpick plugins install <name>@<marketplace>',
203
- },
204
- subCommands: {
205
- list,
206
- add,
207
- remove,
208
- update,
209
- },
210
- });
211
- //# sourceMappingURL=marketplace.js.map