flingit 0.0.19 → 0.0.22

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 (58) hide show
  1. package/dist/cli/commands/dev.d.ts.map +1 -1
  2. package/dist/cli/commands/dev.js +9 -0
  3. package/dist/cli/commands/dev.js.map +1 -1
  4. package/dist/cli/commands/plugin.d.ts +3 -10
  5. package/dist/cli/commands/plugin.d.ts.map +1 -1
  6. package/dist/cli/commands/plugin.js +103 -209
  7. package/dist/cli/commands/plugin.js.map +1 -1
  8. package/dist/cli/commands/push.d.ts +5 -0
  9. package/dist/cli/commands/push.d.ts.map +1 -1
  10. package/dist/cli/commands/push.js +21 -33
  11. package/dist/cli/commands/push.js.map +1 -1
  12. package/dist/cli/deploy/bundler.d.ts +19 -9
  13. package/dist/cli/deploy/bundler.d.ts.map +1 -1
  14. package/dist/cli/deploy/bundler.js +168 -69
  15. package/dist/cli/deploy/bundler.js.map +1 -1
  16. package/dist/cli/utils/config.d.ts +12 -4
  17. package/dist/cli/utils/config.d.ts.map +1 -1
  18. package/dist/cli/utils/config.js +49 -6
  19. package/dist/cli/utils/config.js.map +1 -1
  20. package/dist/runtime/discord.d.ts +20 -58
  21. package/dist/runtime/discord.d.ts.map +1 -1
  22. package/dist/runtime/discord.js +22 -59
  23. package/dist/runtime/discord.js.map +1 -1
  24. package/dist/runtime/slack.d.ts +83 -0
  25. package/dist/runtime/slack.d.ts.map +1 -0
  26. package/dist/runtime/slack.js +87 -0
  27. package/dist/runtime/slack.js.map +1 -0
  28. package/dist/shared/discord-types.d.ts +23 -24
  29. package/dist/shared/discord-types.d.ts.map +1 -1
  30. package/dist/shared/plugin-metadata.d.ts +28 -0
  31. package/dist/shared/plugin-metadata.d.ts.map +1 -0
  32. package/dist/shared/plugin-metadata.js +65 -0
  33. package/dist/shared/plugin-metadata.js.map +1 -0
  34. package/dist/shared/slack-types.d.ts +61 -0
  35. package/dist/shared/slack-types.d.ts.map +1 -0
  36. package/dist/shared/slack-types.js +8 -0
  37. package/dist/shared/slack-types.js.map +1 -0
  38. package/dist/worker-runtime/discord.d.ts +80 -27
  39. package/dist/worker-runtime/discord.d.ts.map +1 -1
  40. package/dist/worker-runtime/discord.js +163 -108
  41. package/dist/worker-runtime/discord.js.map +1 -1
  42. package/dist/worker-runtime/index.d.ts +1 -1
  43. package/dist/worker-runtime/index.d.ts.map +1 -1
  44. package/dist/worker-runtime/index.js +0 -4
  45. package/dist/worker-runtime/index.js.map +1 -1
  46. package/dist/worker-runtime/plugin-common.d.ts +27 -0
  47. package/dist/worker-runtime/plugin-common.d.ts.map +1 -0
  48. package/dist/worker-runtime/plugin-common.js +91 -0
  49. package/dist/worker-runtime/plugin-common.js.map +1 -0
  50. package/dist/worker-runtime/slack.d.ts +67 -0
  51. package/dist/worker-runtime/slack.d.ts.map +1 -0
  52. package/dist/worker-runtime/slack.js +135 -0
  53. package/dist/worker-runtime/slack.js.map +1 -0
  54. package/package.json +8 -1
  55. package/templates/default/skills/fling/.hash +1 -1
  56. package/templates/default/skills/fling/DISCORD.md +112 -122
  57. package/templates/default/skills/fling/SKILL.md +7 -1
  58. package/templates/default/skills/fling/SLACK.md +214 -0
@@ -20,77 +20,40 @@ function localRuntimeWarning(method) {
20
20
  /**
21
21
  * Discord integration helper.
22
22
  *
23
- * Provides methods for sending messages, handling interactions,
24
- * and registering slash commands.
23
+ * Provides methods for sending messages, handling slash commands,
24
+ * and reacting to Discord interactions.
25
25
  *
26
26
  * @example
27
27
  * ```typescript
28
- * import { app } from "flingit";
29
28
  * import { discord } from "flingit/plugin/discord";
30
29
  *
31
- * // Define slash commands (synced on deploy)
32
- * export const commands = discord.defineCommands([
33
- * { name: "deploy", description: "Deploy the current branch" },
34
- * { name: "status", description: "Show deployment status" }
35
- * ]);
36
- *
37
30
  * // Handle slash commands
38
- * app.post("/discord", async (c) => {
39
- * const interaction = await discord.verifyInteraction(c);
40
- *
41
- * if (interaction.data?.name === "deploy") {
42
- * await discord.replyToInteraction(interaction, {
43
- * content: "Starting deployment..."
44
- * });
45
- * }
31
+ * discord.onCommand("ping", "Check if the bot is alive", async (interaction) => {
32
+ * discord.reply(interaction, { content: "Pong!" });
46
33
  * });
47
34
  * ```
48
35
  */
49
36
  export const discord = {
50
37
  /**
51
- * Define slash commands for your project.
52
- * These are registered with Discord when you run `fling push`.
38
+ * Register a handler for a specific slash command (no-op in local runtime).
53
39
  *
54
- * @param commands - Array of command definitions
55
- * @returns The same array (for export)
40
+ * The description is used to register the command with Discord's API
41
+ * during `fling push`. The handler only runs in deployed workers.
56
42
  *
57
- * @example
58
- * ```typescript
59
- * export const commands = discord.defineCommands([
60
- * { name: "ping", description: "Check bot latency" },
61
- * {
62
- * name: "deploy",
63
- * description: "Deploy a branch",
64
- * options: [
65
- * { name: "branch", type: "string", description: "Branch name", required: true }
66
- * ]
67
- * }
68
- * ]);
69
- * ```
43
+ * Accepts an optional options array as the third argument to declare
44
+ * slash command parameters shown in Discord's autocomplete UI.
70
45
  */
71
- defineCommands(commands) {
72
- return commands;
46
+ onCommand(_commandName, _description, _handlerOrOptions, _maybeHandler) {
47
+ // No-op in local runtime — command registration happens at bundle time
73
48
  },
74
49
  /**
75
- * Verify and parse a Discord interaction from a request.
76
- * Discord requires interaction verification within 3 seconds.
77
- *
78
- * @param c - Hono context from the request
79
- * @returns Parsed interaction
80
- *
81
- * @example
82
- * ```typescript
83
- * app.post("/discord", async (c) => {
84
- * const interaction = await discord.verifyInteraction(c);
85
- * // Handle interaction...
86
- * });
87
- * ```
50
+ * Register a fallback handler for interactions (no-op in local runtime).
88
51
  */
89
- async verifyInteraction(_c) {
90
- localRuntimeWarning("verifyInteraction");
52
+ onEvent(_handler) {
53
+ // No-op in local runtime
91
54
  },
92
55
  /**
93
- * Reply to a Discord interaction.
56
+ * Reply to a Discord interaction (slash command).
94
57
  * Must be called within 3 seconds of receiving the interaction.
95
58
  *
96
59
  * @param interaction - The interaction to reply to
@@ -98,14 +61,14 @@ export const discord = {
98
61
  *
99
62
  * @example
100
63
  * ```typescript
101
- * await discord.replyToInteraction(interaction, {
64
+ * discord.reply(interaction, {
102
65
  * content: "Command received!",
103
66
  * ephemeral: true // Only visible to command user
104
67
  * });
105
68
  * ```
106
69
  */
107
- replyToInteraction(_interaction, _options) {
108
- localRuntimeWarning("replyToInteraction");
70
+ reply(_interaction, _options) {
71
+ localRuntimeWarning("reply");
109
72
  },
110
73
  /**
111
74
  * Send a message to a Discord channel.
@@ -175,18 +138,18 @@ export const discord = {
175
138
  * @example
176
139
  * ```typescript
177
140
  * // Initial reply
178
- * await discord.replyToInteraction(interaction, { content: "Processing..." });
141
+ * discord.reply(interaction, { content: "Processing..." });
179
142
  *
180
143
  * // Do some work...
181
144
  *
182
145
  * // Send followup
183
- * await discord.sendFollowup(interaction, {
146
+ * await discord.followup(interaction, {
184
147
  * content: "Done! Here are the results..."
185
148
  * });
186
149
  * ```
187
150
  */
188
- async sendFollowup(_interaction, _options) {
189
- localRuntimeWarning("sendFollowup");
151
+ async followup(_interaction, _options) {
152
+ localRuntimeWarning("followup");
190
153
  },
191
154
  };
192
155
  //# sourceMappingURL=discord.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"discord.js","sourceRoot":"","sources":["../../src/runtime/discord.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAyBH,gFAAgF;AAChF,sCAAsC;AACtC,gFAAgF;AAEhF;;GAEG;AACH,SAAS,mBAAmB,CAAC,MAAc;IACzC,MAAM,IAAI,KAAK,CACb,WAAW,MAAM,4CAA4C;QAC3D,iEAAiE,CACpE,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,cAAc,CAAC,QAA+B;QAC5C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,iBAAiB,CAAC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AAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CACH,YAAgC,EAChC,QAAiC;QAEjC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,CAAC,WAAW,CAAC,QAA4B;QAC5C,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,WAAW,CACf,UAAkB,EAClB,UAAkB,EAClB,QAA4B;QAE5B,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,WAAW,CACf,UAAkB,EAClB,UAAkB,EAClB,MAAc;QAEd,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK,CAAC,QAAQ,CACZ,YAAgC,EAChC,QAAiC;QAEjC,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;CACF,CAAC"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Slack integration for Fling applications (Local runtime)
3
+ *
4
+ * Provides helpers for building Slack chatops bots.
5
+ * This is the local development version - the worker version is in worker-runtime.
6
+ *
7
+ * Note: Slack features require the Slack plugin to be installed.
8
+ * Run `fling plugin install slack` to set up.
9
+ */
10
+ export type { SlackEvent, SlackBlock, SlackMessage, SendMessageOptions, EditMessageOptions, } from "../shared/slack-types.js";
11
+ import type { SlackEvent, SlackMessage, SendMessageOptions, EditMessageOptions } from "../shared/slack-types.js";
12
+ /**
13
+ * An app mention event from Slack.
14
+ */
15
+ export interface MentionEvent {
16
+ type: "app_mention";
17
+ channel: string;
18
+ user: string;
19
+ text: string;
20
+ ts: string;
21
+ thread_ts?: string;
22
+ team?: string;
23
+ }
24
+ type MentionHandler = (event: MentionEvent) => Promise<void> | void;
25
+ type GenericEventHandler = (event: SlackEvent) => Promise<void> | void;
26
+ /**
27
+ * Slack integration helper.
28
+ *
29
+ * Provides methods for sending messages, handling mentions,
30
+ * and reacting to Slack events.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * import { slack } from "flingit/plugin/slack";
35
+ *
36
+ * // Handle mentions
37
+ * slack.onMention(async (event) => {
38
+ * await slack.sendMessage({
39
+ * channelId: event.channel,
40
+ * text: `Hello <@${event.user}>!`,
41
+ * });
42
+ * });
43
+ * ```
44
+ */
45
+ export declare const slack: {
46
+ /**
47
+ * Register a handler for app mention events.
48
+ *
49
+ * @param handler - Function to call when the bot is mentioned
50
+ */
51
+ onMention(_handler: MentionHandler): void;
52
+ /**
53
+ * Register a handler for all Slack events.
54
+ *
55
+ * @param handler - Function to call for each event
56
+ */
57
+ onEvent(_handler: GenericEventHandler): void;
58
+ /**
59
+ * Send a message to a Slack channel.
60
+ *
61
+ * @param options - Message content and target channel
62
+ * @returns The sent message
63
+ */
64
+ sendMessage(_options: SendMessageOptions): Promise<SlackMessage>;
65
+ /**
66
+ * Edit a previously sent message.
67
+ *
68
+ * @param channelId - The channel containing the message
69
+ * @param ts - The timestamp of the message to edit
70
+ * @param options - New message content
71
+ * @returns The edited message
72
+ */
73
+ editMessage(_channelId: string, _ts: string, _options: EditMessageOptions): Promise<SlackMessage>;
74
+ /**
75
+ * Add a reaction to a message.
76
+ *
77
+ * @param channelId - The channel containing the message
78
+ * @param ts - The timestamp of the message to react to
79
+ * @param emoji - The emoji name (without colons)
80
+ */
81
+ addReaction(_channelId: string, _ts: string, _emoji: string): Promise<void>;
82
+ };
83
+ //# sourceMappingURL=slack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slack.d.ts","sourceRoot":"","sources":["../../src/runtime/slack.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,YAAY,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAElC;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAgBD,KAAK,cAAc,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACpE,KAAK,mBAAmB,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAEvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,KAAK;IAChB;;;;OAIG;wBACiB,cAAc,GAAG,IAAI;IAIzC;;;;OAIG;sBACe,mBAAmB,GAAG,IAAI;IAI5C;;;;;OAKG;0BACyB,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC;IAItE;;;;;;;OAOG;4BAEW,MAAM,OACb,MAAM,YACD,kBAAkB,GAC3B,OAAO,CAAC,YAAY,CAAC;IAIxB;;;;;;OAMG;4BAEW,MAAM,OACb,MAAM,UACH,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;CAGjB,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Slack integration for Fling applications (Local runtime)
3
+ *
4
+ * Provides helpers for building Slack chatops bots.
5
+ * This is the local development version - the worker version is in worker-runtime.
6
+ *
7
+ * Note: Slack features require the Slack plugin to be installed.
8
+ * Run `fling plugin install slack` to set up.
9
+ */
10
+ // =============================================================================
11
+ // Slack API (Local Runtime - Stubs)
12
+ // =============================================================================
13
+ /**
14
+ * Local runtime warning - Slack features only work in deployed workers.
15
+ */
16
+ function localRuntimeWarning(method) {
17
+ throw new Error(`slack.${method}() is only available in deployed workers. ` +
18
+ "Use 'fling push' to deploy, then test your Slack integration.");
19
+ }
20
+ /**
21
+ * Slack integration helper.
22
+ *
23
+ * Provides methods for sending messages, handling mentions,
24
+ * and reacting to Slack events.
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * import { slack } from "flingit/plugin/slack";
29
+ *
30
+ * // Handle mentions
31
+ * slack.onMention(async (event) => {
32
+ * await slack.sendMessage({
33
+ * channelId: event.channel,
34
+ * text: `Hello <@${event.user}>!`,
35
+ * });
36
+ * });
37
+ * ```
38
+ */
39
+ export const slack = {
40
+ /**
41
+ * Register a handler for app mention events.
42
+ *
43
+ * @param handler - Function to call when the bot is mentioned
44
+ */
45
+ onMention(_handler) {
46
+ localRuntimeWarning("onMention");
47
+ },
48
+ /**
49
+ * Register a handler for all Slack events.
50
+ *
51
+ * @param handler - Function to call for each event
52
+ */
53
+ onEvent(_handler) {
54
+ localRuntimeWarning("onEvent");
55
+ },
56
+ /**
57
+ * Send a message to a Slack channel.
58
+ *
59
+ * @param options - Message content and target channel
60
+ * @returns The sent message
61
+ */
62
+ async sendMessage(_options) {
63
+ localRuntimeWarning("sendMessage");
64
+ },
65
+ /**
66
+ * Edit a previously sent message.
67
+ *
68
+ * @param channelId - The channel containing the message
69
+ * @param ts - The timestamp of the message to edit
70
+ * @param options - New message content
71
+ * @returns The edited message
72
+ */
73
+ async editMessage(_channelId, _ts, _options) {
74
+ localRuntimeWarning("editMessage");
75
+ },
76
+ /**
77
+ * Add a reaction to a message.
78
+ *
79
+ * @param channelId - The channel containing the message
80
+ * @param ts - The timestamp of the message to react to
81
+ * @param emoji - The emoji name (without colons)
82
+ */
83
+ async addReaction(_channelId, _ts, _emoji) {
84
+ localRuntimeWarning("addReaction");
85
+ },
86
+ };
87
+ //# sourceMappingURL=slack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slack.js","sourceRoot":"","sources":["../../src/runtime/slack.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA+BH,gFAAgF;AAChF,oCAAoC;AACpC,gFAAgF;AAEhF;;GAEG;AACH,SAAS,mBAAmB,CAAC,MAAc;IACzC,MAAM,IAAI,KAAK,CACb,SAAS,MAAM,4CAA4C;QACzD,+DAA+D,CAClE,CAAC;AACJ,CAAC;AAKD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB;;;;OAIG;IACH,SAAS,CAAC,QAAwB;QAChC,mBAAmB,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,QAA6B;QACnC,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CAAC,QAA4B;QAC5C,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,WAAW,CACf,UAAkB,EAClB,GAAW,EACX,QAA4B;QAE5B,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,WAAW,CACf,UAAkB,EAClB,GAAW,EACX,MAAc;QAEd,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;CACF,CAAC"}
@@ -4,30 +4,6 @@
4
4
  * These are the canonical definitions — runtime modules re-export them
5
5
  * so user code can import from "flingit/plugin/discord".
6
6
  */
7
- /**
8
- * Discord slash command definition.
9
- */
10
- export interface DiscordSlashCommand {
11
- /** Command name (1-32 chars, lowercase alphanumeric + hyphens) */
12
- name: string;
13
- /** Command description (1-100 chars) */
14
- description: string;
15
- /** Command options/arguments */
16
- options?: DiscordCommandOption[];
17
- }
18
- /**
19
- * Discord command option (argument).
20
- */
21
- export interface DiscordCommandOption {
22
- name: string;
23
- description: string;
24
- type: "string" | "integer" | "boolean" | "user" | "channel" | "role";
25
- required?: boolean;
26
- choices?: Array<{
27
- name: string;
28
- value: string | number;
29
- }>;
30
- }
31
7
  /**
32
8
  * Discord interaction from a slash command.
33
9
  */
@@ -127,4 +103,27 @@ export interface DiscordMessage {
127
103
  channelId: string;
128
104
  content: string;
129
105
  }
106
+ /**
107
+ * A choice for a Discord command option (enum-style).
108
+ */
109
+ export interface DiscordCommandOptionChoice {
110
+ name: string;
111
+ value: string | number;
112
+ }
113
+ /**
114
+ * A parameter declared on a Discord slash command.
115
+ *
116
+ * Supported types map to Discord application command option types:
117
+ * - "string" → 3 (STRING)
118
+ * - "integer" → 4 (INTEGER)
119
+ * - "boolean" → 5 (BOOLEAN)
120
+ * - "number" → 10 (NUMBER)
121
+ */
122
+ export interface DiscordCommandOption {
123
+ name: string;
124
+ type: "string" | "integer" | "boolean" | "number";
125
+ description: string;
126
+ required?: boolean;
127
+ choices?: DiscordCommandOptionChoice[];
128
+ }
130
129
  //# sourceMappingURL=discord-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"discord-types.d.ts","sourceRoot":"","sources":["../../src/shared/discord-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,OAAO,CAAC,EAAE,oBAAoB,EAAE,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3D;AAED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AAA;KAAE,CAAC;IAC3D,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CACnE;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,0BAA0B,EAAE,CAAC;CACxC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Plugin metadata registry — the single source of truth for plugin identity,
3
+ * display strings, and technical wiring.
4
+ *
5
+ * Consumers (CLI, bundler, runtime) should read from this registry
6
+ * instead of hardcoding per-plugin conditionals.
7
+ */
8
+ export interface PluginMeta {
9
+ id: string;
10
+ name: string;
11
+ description: string;
12
+ hasOAuth: boolean;
13
+ resourceType: string;
14
+ resourceTypePlural: string;
15
+ userLabel: string;
16
+ apis: string[];
17
+ removalNote: string[];
18
+ serviceBinding: string;
19
+ }
20
+ /**
21
+ * Get metadata for a specific plugin by ID.
22
+ */
23
+ export declare function getPluginMeta(id: string): PluginMeta | undefined;
24
+ /**
25
+ * Get all supported plugin IDs.
26
+ */
27
+ export declare function getSupportedPluginIds(): string[];
28
+ //# sourceMappingURL=plugin-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-metadata.d.ts","sourceRoot":"","sources":["../../src/shared/plugin-metadata.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAElB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;IAEtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAgDD;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAEhE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Plugin metadata registry — the single source of truth for plugin identity,
3
+ * display strings, and technical wiring.
4
+ *
5
+ * Consumers (CLI, bundler, runtime) should read from this registry
6
+ * instead of hardcoding per-plugin conditionals.
7
+ */
8
+ const pluginMetadata = [
9
+ {
10
+ id: "discord",
11
+ name: "Discord",
12
+ description: "Discord chatops integration",
13
+ hasOAuth: true,
14
+ resourceType: "server",
15
+ resourceTypePlural: "Servers",
16
+ userLabel: "User",
17
+ apis: [
18
+ "discord.onCommand(name, description, handler)",
19
+ "discord.onEvent(handler)",
20
+ "discord.reply(interaction, content)",
21
+ "discord.followup(interaction, content)",
22
+ "discord.sendMessage(options)",
23
+ "discord.editMessage(channelId, messageId, options)",
24
+ "discord.addReaction(channelId, messageId, emoji)",
25
+ ],
26
+ removalNote: [
27
+ "Note: Fling Bot will remain in your Discord servers.",
28
+ "You can kick it from Server Settings > Members if desired.",
29
+ ],
30
+ serviceBinding: "DISCORD_PLUGIN",
31
+ },
32
+ {
33
+ id: "slack",
34
+ name: "Slack",
35
+ description: "Slack chatops integration",
36
+ hasOAuth: true,
37
+ resourceType: "workspace",
38
+ resourceTypePlural: "Workspaces",
39
+ userLabel: "Workspace",
40
+ apis: [
41
+ "slack.onMention()",
42
+ "slack.sendMessage()",
43
+ "slack.editMessage()",
44
+ "slack.addReaction()",
45
+ ],
46
+ removalNote: [
47
+ "Note: The Fling app will remain in your Slack workspaces.",
48
+ "You can remove it from Apps section in Slack settings if desired.",
49
+ ],
50
+ serviceBinding: "SLACK_PLUGIN",
51
+ },
52
+ ];
53
+ /**
54
+ * Get metadata for a specific plugin by ID.
55
+ */
56
+ export function getPluginMeta(id) {
57
+ return pluginMetadata.find((p) => p.id === id);
58
+ }
59
+ /**
60
+ * Get all supported plugin IDs.
61
+ */
62
+ export function getSupportedPluginIds() {
63
+ return pluginMetadata.map((p) => p.id);
64
+ }
65
+ //# sourceMappingURL=plugin-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-metadata.js","sourceRoot":"","sources":["../../src/shared/plugin-metadata.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAiBH,MAAM,cAAc,GAAiB;IACnC;QACE,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,6BAA6B;QAC1C,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,QAAQ;QACtB,kBAAkB,EAAE,SAAS;QAC7B,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE;YACJ,+CAA+C;YAC/C,0BAA0B;YAC1B,qCAAqC;YACrC,wCAAwC;YACxC,8BAA8B;YAC9B,oDAAoD;YACpD,kDAAkD;SACnD;QACD,WAAW,EAAE;YACX,sDAAsD;YACtD,4DAA4D;SAC7D;QACD,cAAc,EAAE,gBAAgB;KACjC;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,2BAA2B;QACxC,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,WAAW;QACzB,kBAAkB,EAAE,YAAY;QAChC,SAAS,EAAE,WAAW;QACtB,IAAI,EAAE;YACJ,mBAAmB;YACnB,qBAAqB;YACrB,qBAAqB;YACrB,qBAAqB;SACtB;QACD,WAAW,EAAE;YACX,2DAA2D;YAC3D,mEAAmE;SACpE;QACD,cAAc,EAAE,cAAc;KAC/B;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,EAAU;IACtC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACjD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Shared Slack types used by both the plugin worker and worker runtime.
3
+ *
4
+ * These are the canonical definitions — runtime modules re-export them
5
+ * so user code can import from "flingit/plugin/slack".
6
+ */
7
+ /**
8
+ * Slack event payload forwarded to user workers.
9
+ */
10
+ export interface SlackEvent {
11
+ /** Event type: "event_callback" | "app_mention" */
12
+ type: string;
13
+ /** Slack team (workspace) ID */
14
+ team_id?: string;
15
+ /** Channel where the event occurred */
16
+ channel_id?: string;
17
+ /** User who triggered the event */
18
+ user_id?: string;
19
+ /** For event_callback payloads */
20
+ event?: {
21
+ type: string;
22
+ text: string;
23
+ user: string;
24
+ channel: string;
25
+ ts: string;
26
+ thread_ts?: string;
27
+ };
28
+ }
29
+ /**
30
+ * Slack Block Kit block.
31
+ */
32
+ export interface SlackBlock {
33
+ type: string;
34
+ [key: string]: unknown;
35
+ }
36
+ /**
37
+ * Slack message response.
38
+ */
39
+ export interface SlackMessage {
40
+ channelId: string;
41
+ ts: string;
42
+ text: string;
43
+ }
44
+ /**
45
+ * Options for sending a message.
46
+ */
47
+ export interface SendMessageOptions {
48
+ channelId: string;
49
+ text?: string;
50
+ blocks?: SlackBlock[];
51
+ /** Reply in thread */
52
+ threadTs?: string;
53
+ }
54
+ /**
55
+ * Options for editing a message.
56
+ */
57
+ export interface EditMessageOptions {
58
+ text?: string;
59
+ blocks?: SlackBlock[];
60
+ }
61
+ //# sourceMappingURL=slack-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slack-types.d.ts","sourceRoot":"","sources":["../../src/shared/slack-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,EAAE,EAAE,MAAM,CAAC;QACX,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IACtB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;CACvB"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shared Slack types used by both the plugin worker and worker runtime.
3
+ *
4
+ * These are the canonical definitions — runtime modules re-export them
5
+ * so user code can import from "flingit/plugin/slack".
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=slack-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slack-types.js","sourceRoot":"","sources":["../../src/shared/slack-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}