figmanage 1.2.9 → 1.3.1
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/README.md +10 -8
- package/dist/cli/analytics.js +3 -2
- package/dist/cli/branching.js +9 -3
- package/dist/cli/comments.js +10 -4
- package/dist/cli/components.js +21 -4
- package/dist/cli/compound-commands.js +13 -12
- package/dist/cli/export.js +3 -2
- package/dist/cli/files.js +14 -8
- package/dist/cli/helpers.d.ts +1 -0
- package/dist/cli/helpers.js +10 -0
- package/dist/cli/libraries.js +2 -1
- package/dist/cli/navigate.js +11 -10
- package/dist/cli/org.js +13 -12
- package/dist/cli/permissions.js +13 -7
- package/dist/cli/projects.js +12 -6
- package/dist/cli/reading.js +3 -2
- package/dist/cli/teams.js +9 -3
- package/dist/cli/variables.js +29 -7
- package/dist/cli/versions.js +3 -2
- package/dist/cli/webhooks.js +14 -4
- package/dist/helpers.d.ts +11 -0
- package/dist/helpers.js +41 -0
- package/dist/mcp.js +18 -6
- package/dist/operations/analytics.js +1 -1
- package/dist/operations/components.d.ts +8 -2
- package/dist/operations/components.js +4 -2
- package/dist/operations/compound-manager.js +8 -9
- package/dist/operations/compound.d.ts +3 -0
- package/dist/operations/compound.js +14 -8
- package/dist/operations/files.js +1 -1
- package/dist/operations/libraries.js +1 -1
- package/dist/operations/org.js +1 -1
- package/dist/operations/reading.js +2 -0
- package/dist/operations/teams.js +1 -1
- package/dist/operations/variables.js +11 -0
- package/dist/operations/webhooks.d.ts +4 -1
- package/dist/operations/webhooks.js +2 -1
- package/dist/tools/analytics.js +6 -5
- package/dist/tools/branching.js +7 -6
- package/dist/tools/comments.js +14 -9
- package/dist/tools/components.js +24 -15
- package/dist/tools/compound-manager.js +10 -7
- package/dist/tools/compound.js +34 -22
- package/dist/tools/export.js +6 -5
- package/dist/tools/files.js +13 -12
- package/dist/tools/libraries.js +6 -3
- package/dist/tools/navigate.js +29 -18
- package/dist/tools/org.js +25 -24
- package/dist/tools/permissions.js +14 -11
- package/dist/tools/projects.js +10 -9
- package/dist/tools/reading.js +11 -7
- package/dist/tools/register.d.ts +8 -2
- package/dist/tools/register.js +9 -14
- package/dist/tools/setup.d.ts +10 -0
- package/dist/tools/setup.js +181 -0
- package/dist/tools/teams.js +7 -6
- package/dist/tools/variables.js +12 -8
- package/dist/tools/versions.js +6 -5
- package/dist/tools/webhooks.js +15 -12
- package/package.json +1 -1
package/dist/tools/webhooks.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { defineTool, toolResult, toolError, figmaId } from './register.js';
|
|
2
|
+
import { defineTool, toolResult, toolError, toolSummary, figmaId } from './register.js';
|
|
3
|
+
import { formatApiError } from '../helpers.js';
|
|
3
4
|
import { listWebhooks, createWebhook, updateWebhook, deleteWebhook, } from '../operations/webhooks.js';
|
|
4
5
|
const eventTypeEnum = z.enum([
|
|
5
6
|
'FILE_UPDATE',
|
|
@@ -15,17 +16,19 @@ defineTool({
|
|
|
15
16
|
auth: 'pat',
|
|
16
17
|
register(server, config) {
|
|
17
18
|
server.registerTool('list_webhooks', {
|
|
18
|
-
description: 'List
|
|
19
|
+
description: 'List webhook subscriptions for a team. Returns webhook IDs, endpoints, event types, and status.',
|
|
19
20
|
inputSchema: {
|
|
20
21
|
team_id: figmaId.describe('Team ID'),
|
|
21
22
|
},
|
|
22
23
|
}, async ({ team_id }) => {
|
|
23
24
|
try {
|
|
24
|
-
const
|
|
25
|
-
|
|
25
|
+
const result = await listWebhooks(config, { team_id });
|
|
26
|
+
if (result.count === 0)
|
|
27
|
+
return toolResult('No webhooks configured for this team.');
|
|
28
|
+
return toolSummary(`${result.count} webhook(s).`, result, 'Use create_webhook to add, or update_webhook/delete_webhook to manage.');
|
|
26
29
|
}
|
|
27
30
|
catch (e) {
|
|
28
|
-
return toolError(`Failed to list webhooks: ${e
|
|
31
|
+
return toolError(`Failed to list webhooks: ${formatApiError(e)}`);
|
|
29
32
|
}
|
|
30
33
|
});
|
|
31
34
|
},
|
|
@@ -48,10 +51,10 @@ defineTool({
|
|
|
48
51
|
}, async ({ team_id, event_type, endpoint, passcode, description }) => {
|
|
49
52
|
try {
|
|
50
53
|
const result = await createWebhook(config, { team_id, event_type, endpoint, passcode, description });
|
|
51
|
-
return
|
|
54
|
+
return toolSummary(`Created webhook ${result.id || 'unknown'} for ${result.event_type || event_type} events.`, result);
|
|
52
55
|
}
|
|
53
56
|
catch (e) {
|
|
54
|
-
return toolError(`Failed to create webhook: ${e
|
|
57
|
+
return toolError(`Failed to create webhook: ${formatApiError(e)}`);
|
|
55
58
|
}
|
|
56
59
|
});
|
|
57
60
|
},
|
|
@@ -63,7 +66,7 @@ defineTool({
|
|
|
63
66
|
mutates: true,
|
|
64
67
|
register(server, config) {
|
|
65
68
|
server.registerTool('update_webhook', {
|
|
66
|
-
description:
|
|
69
|
+
description: "Update a webhook's endpoint, event type, passcode, description, or status (ACTIVE/PAUSED).",
|
|
67
70
|
inputSchema: {
|
|
68
71
|
webhook_id: figmaId.describe('Webhook ID'),
|
|
69
72
|
event_type: eventTypeEnum.optional().describe('Event type to subscribe to'),
|
|
@@ -75,10 +78,10 @@ defineTool({
|
|
|
75
78
|
}, async ({ webhook_id, event_type, endpoint, passcode, description, status }) => {
|
|
76
79
|
try {
|
|
77
80
|
const result = await updateWebhook(config, { webhook_id, event_type, endpoint, passcode, description, status });
|
|
78
|
-
return
|
|
81
|
+
return toolSummary(`Updated webhook ${result.id || webhook_id}.`, result);
|
|
79
82
|
}
|
|
80
83
|
catch (e) {
|
|
81
|
-
return toolError(`Failed to update webhook: ${e
|
|
84
|
+
return toolError(`Failed to update webhook: ${formatApiError(e)}`);
|
|
82
85
|
}
|
|
83
86
|
});
|
|
84
87
|
},
|
|
@@ -91,7 +94,7 @@ defineTool({
|
|
|
91
94
|
destructive: true,
|
|
92
95
|
register(server, config) {
|
|
93
96
|
server.registerTool('delete_webhook', {
|
|
94
|
-
description: '
|
|
97
|
+
description: 'Permanently delete a webhook. The webhook stops receiving events immediately. Cannot be undone.',
|
|
95
98
|
inputSchema: {
|
|
96
99
|
webhook_id: figmaId.describe('Webhook ID'),
|
|
97
100
|
},
|
|
@@ -101,7 +104,7 @@ defineTool({
|
|
|
101
104
|
return toolResult(`Deleted webhook ${webhook_id}`);
|
|
102
105
|
}
|
|
103
106
|
catch (e) {
|
|
104
|
-
return toolError(`Failed to delete webhook: ${e
|
|
107
|
+
return toolError(`Failed to delete webhook: ${formatApiError(e)}`);
|
|
105
108
|
}
|
|
106
109
|
});
|
|
107
110
|
},
|
package/package.json
CHANGED