@intentsolutions/blueprint-chatbots 2.0.0

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.
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Discord Bot for Intent Blueprint Docs
3
+ *
4
+ * Commands:
5
+ * - /blueprint <name> <description> [scope] - Generate documentation
6
+ * - /blueprint-help - Show usage information
7
+ */
8
+ export interface DiscordBotConfig {
9
+ token: string;
10
+ clientId: string;
11
+ guildId?: string;
12
+ smtp?: {
13
+ host: string;
14
+ port: number;
15
+ auth: {
16
+ user: string;
17
+ pass: string;
18
+ };
19
+ };
20
+ }
21
+ export declare class DiscordBot {
22
+ private client;
23
+ private generator;
24
+ private delivery;
25
+ private config;
26
+ constructor(config: DiscordBotConfig);
27
+ private registerEventHandlers;
28
+ private handleCommand;
29
+ private handleGenerate;
30
+ private handleHelp;
31
+ registerCommands(): Promise<void>;
32
+ start(): Promise<void>;
33
+ }
34
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/discord/app.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;KACtC,CAAC;CACH;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAe;IAChC,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,MAAM,CAAmB;gBAErB,MAAM,EAAE,gBAAgB;IAWpC,OAAO,CAAC,qBAAqB;YAWf,aAAa;YAYb,cAAc;YA+Dd,UAAU;IAwBlB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IA8DjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B"}
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Discord Bot for Intent Blueprint Docs
3
+ *
4
+ * Commands:
5
+ * - /blueprint <name> <description> [scope] - Generate documentation
6
+ * - /blueprint-help - Show usage information
7
+ */
8
+ import { Client, GatewayIntentBits, SlashCommandBuilder, REST, Routes, AttachmentBuilder, EmbedBuilder, } from 'discord.js';
9
+ import { DocGenerator } from '../shared/generator.js';
10
+ import { DocDelivery } from '../shared/delivery.js';
11
+ export class DiscordBot {
12
+ client;
13
+ generator;
14
+ delivery;
15
+ config;
16
+ constructor(config) {
17
+ this.config = config;
18
+ this.client = new Client({
19
+ intents: [GatewayIntentBits.Guilds],
20
+ });
21
+ this.generator = new DocGenerator();
22
+ this.delivery = new DocDelivery({ smtp: config.smtp });
23
+ this.registerEventHandlers();
24
+ }
25
+ registerEventHandlers() {
26
+ this.client.on('ready', () => {
27
+ console.log(`Discord bot logged in as ${this.client.user?.tag}`);
28
+ });
29
+ this.client.on('interactionCreate', async (interaction) => {
30
+ if (!interaction.isChatInputCommand())
31
+ return;
32
+ await this.handleCommand(interaction);
33
+ });
34
+ }
35
+ async handleCommand(interaction) {
36
+ if (!interaction.isChatInputCommand())
37
+ return;
38
+ const { commandName } = interaction;
39
+ if (commandName === 'blueprint') {
40
+ await this.handleGenerate(interaction);
41
+ }
42
+ else if (commandName === 'blueprint-help') {
43
+ await this.handleHelp(interaction);
44
+ }
45
+ }
46
+ async handleGenerate(interaction) {
47
+ const projectName = interaction.options.getString('name', true);
48
+ const projectDescription = interaction.options.getString('description', true);
49
+ const scope = interaction.options.getString('scope') || 'standard';
50
+ const email = interaction.options.getString('email');
51
+ await interaction.deferReply();
52
+ try {
53
+ // Generate docs
54
+ const result = await this.generator.generate({
55
+ projectName,
56
+ projectDescription,
57
+ scope: scope,
58
+ });
59
+ const stats = this.delivery.getFileStats(result.zipPath);
60
+ // Create embed
61
+ const embed = new EmbedBuilder()
62
+ .setColor(0x5865F2)
63
+ .setTitle(`Documentation Generated`)
64
+ .setDescription(`Your docs for **${projectName}** are ready!`)
65
+ .addFields({ name: 'Documents', value: `${result.files.length} files`, inline: true }, { name: 'Scope', value: scope, inline: true }, { name: 'Size', value: stats.size, inline: true })
66
+ .setFooter({ text: 'Intent Blueprint Docs' })
67
+ .setTimestamp();
68
+ // Create attachment
69
+ const attachment = new AttachmentBuilder(result.zipPath, {
70
+ name: `${projectName.toLowerCase().replace(/[^a-z0-9]/g, '-')}-docs.zip`,
71
+ description: `Documentation for ${projectName}`,
72
+ });
73
+ await interaction.editReply({
74
+ embeds: [embed],
75
+ files: [attachment],
76
+ });
77
+ // Email if requested
78
+ if (email) {
79
+ const emailResult = await this.delivery.sendEmail(email, projectName, result.zipPath);
80
+ if (emailResult.success) {
81
+ await interaction.followUp({
82
+ content: `Docs also sent to ${email}`,
83
+ ephemeral: true,
84
+ });
85
+ }
86
+ }
87
+ // Cleanup
88
+ this.generator.cleanup(result.outputDir, result.zipPath);
89
+ }
90
+ catch (error) {
91
+ await interaction.editReply({
92
+ content: `Error generating docs: ${error instanceof Error ? error.message : 'Unknown error'}`,
93
+ });
94
+ }
95
+ }
96
+ async handleHelp(interaction) {
97
+ const embed = new EmbedBuilder()
98
+ .setColor(0x5865F2)
99
+ .setTitle('Intent Blueprint Docs')
100
+ .setDescription('Generate professional documentation for your projects')
101
+ .addFields({
102
+ name: '/blueprint',
103
+ value: 'Generate documentation\n`/blueprint name:"My Project" description:"A cool app" scope:standard`',
104
+ }, {
105
+ name: 'Scopes',
106
+ value: '- **mvp**: 4 essential docs\n- **standard**: 12 core docs\n- **comprehensive**: 22 complete docs',
107
+ }, {
108
+ name: 'Optional',
109
+ value: 'Add `email:your@email.com` to receive docs via email',
110
+ })
111
+ .setFooter({ text: 'https://github.com/intent-solutions-io/intent-blueprint-docs' });
112
+ await interaction.reply({ embeds: [embed], ephemeral: true });
113
+ }
114
+ async registerCommands() {
115
+ const commands = [
116
+ new SlashCommandBuilder()
117
+ .setName('blueprint')
118
+ .setDescription('Generate project documentation')
119
+ .addStringOption(option => option
120
+ .setName('name')
121
+ .setDescription('Project name')
122
+ .setRequired(true))
123
+ .addStringOption(option => option
124
+ .setName('description')
125
+ .setDescription('Project description')
126
+ .setRequired(true))
127
+ .addStringOption(option => option
128
+ .setName('scope')
129
+ .setDescription('Documentation scope')
130
+ .addChoices({ name: 'MVP (4 docs)', value: 'mvp' }, { name: 'Standard (12 docs)', value: 'standard' }, { name: 'Comprehensive (22 docs)', value: 'comprehensive' }))
131
+ .addStringOption(option => option
132
+ .setName('email')
133
+ .setDescription('Email address for delivery (optional)')),
134
+ new SlashCommandBuilder()
135
+ .setName('blueprint-help')
136
+ .setDescription('Show Intent Blueprint help'),
137
+ ];
138
+ const rest = new REST().setToken(this.config.token);
139
+ try {
140
+ console.log('Registering Discord slash commands...');
141
+ if (this.config.guildId) {
142
+ // Development: guild-specific commands (instant)
143
+ await rest.put(Routes.applicationGuildCommands(this.config.clientId, this.config.guildId), { body: commands.map(cmd => cmd.toJSON()) });
144
+ }
145
+ else {
146
+ // Production: global commands (may take up to 1 hour)
147
+ await rest.put(Routes.applicationCommands(this.config.clientId), { body: commands.map(cmd => cmd.toJSON()) });
148
+ }
149
+ console.log('Commands registered successfully');
150
+ }
151
+ catch (error) {
152
+ console.error('Failed to register commands:', error);
153
+ }
154
+ }
155
+ async start() {
156
+ await this.registerCommands();
157
+ await this.client.login(this.config.token);
158
+ }
159
+ }
160
+ // CLI runner
161
+ if (import.meta.url === `file://${process.argv[1]}`) {
162
+ const bot = new DiscordBot({
163
+ token: process.env.DISCORD_TOKEN,
164
+ clientId: process.env.DISCORD_CLIENT_ID,
165
+ guildId: process.env.DISCORD_GUILD_ID,
166
+ });
167
+ bot.start();
168
+ }
169
+ //# sourceMapping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,CAAC,EAChD,EAAE,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,CAC5C,CAAC;YACJ,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC9B,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,aAAa;AACb,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACpD,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC;QACzB,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,aAAc;QACjC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAkB;QACxC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;KACtC,CAAC,CAAC;IACH,GAAG,CAAC,KAAK,EAAE,CAAC;AACd,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Intent Blueprint Chat Integrations
3
+ * Slack and Discord bots for doc generation with download/email delivery
4
+ */
5
+ export { SlackBot } from './slack/app.js';
6
+ export { DiscordBot } from './discord/app.js';
7
+ export { DocDelivery, type DeliveryOptions } from './shared/delivery.js';
8
+ export { DocGenerator, type GeneratorOptions } from './shared/generator.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Intent Blueprint Chat Integrations
3
+ * Slack and Discord bots for doc generation with download/email delivery
4
+ */
5
+ export { SlackBot } from './slack/app.js';
6
+ export { DiscordBot } from './discord/app.js';
7
+ export { DocDelivery } from './shared/delivery.js';
8
+ export { DocGenerator } from './shared/generator.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAwB,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAyB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Document delivery via email or file upload
3
+ */
4
+ export interface DeliveryOptions {
5
+ smtp?: {
6
+ host: string;
7
+ port: number;
8
+ secure?: boolean;
9
+ auth: {
10
+ user: string;
11
+ pass: string;
12
+ };
13
+ };
14
+ from?: string;
15
+ }
16
+ export interface EmailDeliveryResult {
17
+ success: boolean;
18
+ messageId?: string;
19
+ error?: string;
20
+ }
21
+ export declare class DocDelivery {
22
+ private transporter;
23
+ private from;
24
+ constructor(options?: DeliveryOptions);
25
+ sendEmail(to: string, projectName: string, zipPath: string): Promise<EmailDeliveryResult>;
26
+ /**
27
+ * Read zip file as buffer for direct upload to Slack/Discord
28
+ */
29
+ getZipBuffer(zipPath: string): Buffer;
30
+ /**
31
+ * Get file stats for display
32
+ */
33
+ getFileStats(zipPath: string): {
34
+ size: string;
35
+ files: number;
36
+ };
37
+ }
38
+ //# sourceMappingURL=delivery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery.d.ts","sourceRoot":"","sources":["../../src/shared/delivery.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,WAAW,CAAuC;IAC1D,OAAO,CAAC,IAAI,CAAS;gBAET,OAAO,GAAE,eAAoB;IAanC,SAAS,CACb,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,mBAAmB,CAAC;IAyC/B;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAIrC;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;CAO/D"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Document delivery via email or file upload
3
+ */
4
+ import nodemailer from 'nodemailer';
5
+ import * as fs from 'fs';
6
+ export class DocDelivery {
7
+ transporter = null;
8
+ from;
9
+ constructor(options = {}) {
10
+ this.from = options.from || 'noreply@intentsolutions.io';
11
+ if (options.smtp) {
12
+ this.transporter = nodemailer.createTransport({
13
+ host: options.smtp.host,
14
+ port: options.smtp.port,
15
+ secure: options.smtp.secure ?? options.smtp.port === 465,
16
+ auth: options.smtp.auth,
17
+ });
18
+ }
19
+ }
20
+ async sendEmail(to, projectName, zipPath) {
21
+ if (!this.transporter) {
22
+ return {
23
+ success: false,
24
+ error: 'Email not configured. Set SMTP options to enable email delivery.',
25
+ };
26
+ }
27
+ try {
28
+ const info = await this.transporter.sendMail({
29
+ from: this.from,
30
+ to,
31
+ subject: `Intent Blueprint Docs: ${projectName}`,
32
+ text: `Your documentation for "${projectName}" is attached.\n\nGenerated by Intent Blueprint Docs\nhttps://github.com/intent-solutions-io/intent-blueprint-docs`,
33
+ html: `
34
+ <h2>Your Documentation is Ready!</h2>
35
+ <p>Your documentation for <strong>${projectName}</strong> is attached as a ZIP file.</p>
36
+ <p>Extract the ZIP to view all generated documents.</p>
37
+ <hr>
38
+ <p><small>Generated by <a href="https://github.com/intent-solutions-io/intent-blueprint-docs">Intent Blueprint Docs</a></small></p>
39
+ `,
40
+ attachments: [
41
+ {
42
+ filename: `${projectName.toLowerCase().replace(/[^a-z0-9]/g, '-')}-docs.zip`,
43
+ path: zipPath,
44
+ },
45
+ ],
46
+ });
47
+ return {
48
+ success: true,
49
+ messageId: info.messageId,
50
+ };
51
+ }
52
+ catch (error) {
53
+ return {
54
+ success: false,
55
+ error: error instanceof Error ? error.message : 'Unknown error',
56
+ };
57
+ }
58
+ }
59
+ /**
60
+ * Read zip file as buffer for direct upload to Slack/Discord
61
+ */
62
+ getZipBuffer(zipPath) {
63
+ return fs.readFileSync(zipPath);
64
+ }
65
+ /**
66
+ * Get file stats for display
67
+ */
68
+ getFileStats(zipPath) {
69
+ const stats = fs.statSync(zipPath);
70
+ const sizeKB = Math.round(stats.size / 1024);
71
+ const size = sizeKB > 1024 ? `${(sizeKB / 1024).toFixed(1)} MB` : `${sizeKB} KB`;
72
+ return { size, files: 0 }; // File count would need to be passed in
73
+ }
74
+ }
75
+ //# sourceMappingURL=delivery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery.js","sourceRoot":"","sources":["../../src/shared/delivery.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAsBzB,MAAM,OAAO,WAAW;IACd,WAAW,GAAkC,IAAI,CAAC;IAClD,IAAI,CAAS;IAErB,YAAY,UAA2B,EAAE;QACvC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,4BAA4B,CAAC;QAEzD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,eAAe,CAAC;gBAC5C,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI;gBACvB,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI;gBACvB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,GAAG;gBACxD,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI;aACxB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,KAAK,CAAC,SAAS,CACb,EAAU,EACV,WAAmB,EACnB,OAAe;QAEf,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,kEAAkE;aAC1E,CAAC;QACJ,CAAC;QAED,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;gBAC3C,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,EAAE;gBACF,OAAO,EAAE,0BAA0B,WAAW,EAAE;gBAChD,IAAI,EAAE,2BAA2B,WAAW,oHAAoH;gBAChK,IAAI,EAAE;;8CAEgC,WAAW;;;;SAIhD;gBACD,WAAW,EAAE;oBACX;wBACE,QAAQ,EAAE,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,WAAW;wBAC5E,IAAI,EAAE,OAAO;qBACd;iBACF;aACF,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,IAAI,CAAC,SAAS;aAC1B,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;aAChE,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,OAAe;QAC1B,OAAO,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,OAAe;QAC1B,MAAM,KAAK,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACnC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;QAC7C,MAAM,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,KAAK,CAAC;QAEjF,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,wCAAwC;IACrE,CAAC;CACF"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Shared document generator for chat integrations
3
+ */
4
+ export interface GeneratorOptions {
5
+ projectName: string;
6
+ projectDescription: string;
7
+ scope?: 'mvp' | 'standard' | 'comprehensive';
8
+ audience?: 'startup' | 'business' | 'enterprise';
9
+ outputDir?: string;
10
+ }
11
+ export interface GeneratedDocs {
12
+ files: string[];
13
+ zipPath: string;
14
+ outputDir: string;
15
+ }
16
+ export declare class DocGenerator {
17
+ private tempDir;
18
+ constructor(tempDir?: string);
19
+ generate(options: GeneratorOptions): Promise<GeneratedDocs>;
20
+ private createZip;
21
+ cleanup(outputDir: string, zipPath: string): void;
22
+ }
23
+ //# sourceMappingURL=generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/shared/generator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,KAAK,GAAG,UAAU,GAAG,eAAe,CAAC;IAC7C,QAAQ,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,YAAY,CAAC;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,GAAE,MAA8B;IAO7C,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;YAoCnD,SAAS;IAevB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;CAQlD"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Shared document generator for chat integrations
3
+ */
4
+ import { generateAllDocuments, writeDocuments, } from '@intentsolutions/blueprint-core';
5
+ import * as fs from 'fs';
6
+ import * as path from 'path';
7
+ import archiver from 'archiver';
8
+ export class DocGenerator {
9
+ tempDir;
10
+ constructor(tempDir = '/tmp/blueprint-docs') {
11
+ this.tempDir = tempDir;
12
+ if (!fs.existsSync(tempDir)) {
13
+ fs.mkdirSync(tempDir, { recursive: true });
14
+ }
15
+ }
16
+ async generate(options) {
17
+ const { projectName, projectDescription, scope = 'standard', audience = 'business', } = options;
18
+ const context = {
19
+ projectName,
20
+ projectDescription,
21
+ scope,
22
+ audience,
23
+ };
24
+ // Generate documents
25
+ const docs = generateAllDocuments(context);
26
+ // Create unique output directory
27
+ const timestamp = Date.now();
28
+ const safeName = projectName.toLowerCase().replace(/[^a-z0-9]/g, '-');
29
+ const outputDir = path.join(this.tempDir, `${safeName}-${timestamp}`);
30
+ // Write documents
31
+ const files = writeDocuments(docs, outputDir);
32
+ // Create zip archive
33
+ const zipPath = await this.createZip(outputDir, safeName);
34
+ return {
35
+ files,
36
+ zipPath,
37
+ outputDir,
38
+ };
39
+ }
40
+ async createZip(sourceDir, name) {
41
+ const zipPath = path.join(this.tempDir, `${name}-${Date.now()}.zip`);
42
+ const output = fs.createWriteStream(zipPath);
43
+ const archive = archiver('zip', { zlib: { level: 9 } });
44
+ return new Promise((resolve, reject) => {
45
+ output.on('close', () => resolve(zipPath));
46
+ archive.on('error', reject);
47
+ archive.pipe(output);
48
+ archive.directory(sourceDir, false);
49
+ archive.finalize();
50
+ });
51
+ }
52
+ cleanup(outputDir, zipPath) {
53
+ try {
54
+ fs.rmSync(outputDir, { recursive: true, force: true });
55
+ fs.rmSync(zipPath, { force: true });
56
+ }
57
+ catch {
58
+ // Ignore cleanup errors
59
+ }
60
+ }
61
+ }
62
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/shared/generator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,oBAAoB,EACpB,cAAc,GAEf,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,QAAQ,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C,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACrE,MAAM,MAAM,GAAG,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC7C,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAExD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;YAC3C,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAE5B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACrB,OAAO,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;YACpC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CAAC,SAAiB,EAAE,OAAe;QACxC,IAAI,CAAC;YACH,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACvD,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACtC,CAAC;QAAC,MAAM,CAAC;YACP,wBAAwB;QAC1B,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Slack Bot for Intent Blueprint Docs
3
+ *
4
+ * Usage:
5
+ * - /blueprint <project-name> - Generate docs with interactive modal
6
+ * - @Blueprint generate <name> <description> - Direct generation
7
+ */
8
+ export interface SlackBotConfig {
9
+ token: string;
10
+ signingSecret: string;
11
+ appToken?: string;
12
+ smtp?: {
13
+ host: string;
14
+ port: number;
15
+ auth: {
16
+ user: string;
17
+ pass: string;
18
+ };
19
+ };
20
+ }
21
+ export declare class SlackBot {
22
+ private app;
23
+ private generator;
24
+ private delivery;
25
+ constructor(config: SlackBotConfig);
26
+ private registerCommands;
27
+ private registerActions;
28
+ start(port?: number): Promise<void>;
29
+ }
30
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/slack/app.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;KACtC,CAAC;CACH;AAED,qBAAa,QAAQ;IACnB,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,SAAS,CAAe;IAChC,OAAO,CAAC,QAAQ,CAAc;gBAElB,MAAM,EAAE,cAAc;IAgBlC,OAAO,CAAC,gBAAgB;IAqExB,OAAO,CAAC,eAAe;IA6DjB,KAAK,CAAC,IAAI,GAAE,MAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAIhD"}
@@ -0,0 +1,163 @@
1
+ /**
2
+ * Slack Bot for Intent Blueprint Docs
3
+ *
4
+ * Usage:
5
+ * - /blueprint <project-name> - Generate docs with interactive modal
6
+ * - @Blueprint generate <name> <description> - Direct generation
7
+ */
8
+ import { App, LogLevel } from '@slack/bolt';
9
+ import { DocGenerator } from '../shared/generator.js';
10
+ import { DocDelivery } from '../shared/delivery.js';
11
+ export class SlackBot {
12
+ app;
13
+ generator;
14
+ delivery;
15
+ constructor(config) {
16
+ this.app = new App({
17
+ token: config.token,
18
+ signingSecret: config.signingSecret,
19
+ socketMode: !!config.appToken,
20
+ appToken: config.appToken,
21
+ logLevel: LogLevel.INFO,
22
+ });
23
+ this.generator = new DocGenerator();
24
+ this.delivery = new DocDelivery({ smtp: config.smtp });
25
+ this.registerCommands();
26
+ this.registerActions();
27
+ }
28
+ registerCommands() {
29
+ // Slash command: /blueprint
30
+ this.app.command('/blueprint', async ({ command, ack, client }) => {
31
+ await ack();
32
+ await client.views.open({
33
+ trigger_id: command.trigger_id,
34
+ view: {
35
+ type: 'modal',
36
+ callback_id: 'generate_docs',
37
+ title: { type: 'plain_text', text: 'Generate Docs' },
38
+ submit: { type: 'plain_text', text: 'Generate' },
39
+ blocks: [
40
+ {
41
+ type: 'input',
42
+ block_id: 'project_name',
43
+ element: {
44
+ type: 'plain_text_input',
45
+ action_id: 'input',
46
+ placeholder: { type: 'plain_text', text: 'My Awesome Project' },
47
+ },
48
+ label: { type: 'plain_text', text: 'Project Name' },
49
+ },
50
+ {
51
+ type: 'input',
52
+ block_id: 'project_description',
53
+ element: {
54
+ type: 'plain_text_input',
55
+ action_id: 'input',
56
+ multiline: true,
57
+ placeholder: { type: 'plain_text', text: 'Describe your project...' },
58
+ },
59
+ label: { type: 'plain_text', text: 'Description' },
60
+ },
61
+ {
62
+ type: 'input',
63
+ block_id: 'scope',
64
+ element: {
65
+ type: 'static_select',
66
+ action_id: 'select',
67
+ initial_option: {
68
+ text: { type: 'plain_text', text: 'Standard (12 docs)' },
69
+ value: 'standard',
70
+ },
71
+ options: [
72
+ { text: { type: 'plain_text', text: 'MVP (4 docs)' }, value: 'mvp' },
73
+ { text: { type: 'plain_text', text: 'Standard (12 docs)' }, value: 'standard' },
74
+ { text: { type: 'plain_text', text: 'Comprehensive (22 docs)' }, value: 'comprehensive' },
75
+ ],
76
+ },
77
+ label: { type: 'plain_text', text: 'Documentation Scope' },
78
+ },
79
+ {
80
+ type: 'input',
81
+ block_id: 'email',
82
+ optional: true,
83
+ element: {
84
+ type: 'plain_text_input',
85
+ action_id: 'input',
86
+ placeholder: { type: 'plain_text', text: 'your@email.com (optional)' },
87
+ },
88
+ label: { type: 'plain_text', text: 'Email (for delivery)' },
89
+ },
90
+ ],
91
+ },
92
+ });
93
+ });
94
+ }
95
+ registerActions() {
96
+ // Modal submission handler
97
+ this.app.view('generate_docs', async ({ ack, view, client, body }) => {
98
+ await ack();
99
+ const values = view.state.values;
100
+ const projectName = values.project_name.input.value;
101
+ const projectDescription = values.project_description.input.value;
102
+ const scope = values.scope.select.selected_option.value;
103
+ const email = values.email?.input?.value;
104
+ const userId = body.user.id;
105
+ // Notify user that generation is starting
106
+ await client.chat.postMessage({
107
+ channel: userId,
108
+ text: `Generating documentation for "${projectName}"...`,
109
+ });
110
+ try {
111
+ // Generate docs
112
+ const result = await this.generator.generate({
113
+ projectName,
114
+ projectDescription,
115
+ scope,
116
+ });
117
+ // Upload to user's DM
118
+ await client.files.uploadV2({
119
+ channel_id: userId,
120
+ file: this.delivery.getZipBuffer(result.zipPath),
121
+ filename: `${projectName.toLowerCase().replace(/[^a-z0-9]/g, '-')}-docs.zip`,
122
+ title: `${projectName} Documentation`,
123
+ initial_comment: `Here's your documentation package for "${projectName}"!\n\n` +
124
+ `- ${result.files.length} documents generated\n` +
125
+ `- Scope: ${scope}\n\n` +
126
+ `Extract the ZIP to view all markdown files.`,
127
+ });
128
+ // Email if requested
129
+ if (email) {
130
+ const emailResult = await this.delivery.sendEmail(email, projectName, result.zipPath);
131
+ if (emailResult.success) {
132
+ await client.chat.postMessage({
133
+ channel: userId,
134
+ text: `Docs also sent to ${email}`,
135
+ });
136
+ }
137
+ }
138
+ // Cleanup
139
+ this.generator.cleanup(result.outputDir, result.zipPath);
140
+ }
141
+ catch (error) {
142
+ await client.chat.postMessage({
143
+ channel: userId,
144
+ text: `Error generating docs: ${error instanceof Error ? error.message : 'Unknown error'}`,
145
+ });
146
+ }
147
+ });
148
+ }
149
+ async start(port = 3000) {
150
+ await this.app.start(port);
151
+ console.log(`Slack bot running on port ${port}`);
152
+ }
153
+ }
154
+ // CLI runner
155
+ if (import.meta.url === `file://${process.argv[1]}`) {
156
+ const bot = new SlackBot({
157
+ token: process.env.SLACK_BOT_TOKEN,
158
+ signingSecret: process.env.SLACK_SIGNING_SECRET,
159
+ appToken: process.env.SLACK_APP_TOKEN,
160
+ });
161
+ bot.start(Number(process.env.PORT) || 3000);
162
+ }
163
+ //# sourceMappingURL=app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/slack/app.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAapD,MAAM,OAAO,QAAQ;IACX,GAAG,CAAM;IACT,SAAS,CAAe;IACxB,QAAQ,CAAc;IAE9B,YAAY,MAAsB;QAChC,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC;YACjB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ;YAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,QAAQ,CAAC,IAAI;SACxB,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,EAAE,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,IAAI,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAEvD,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAEO,gBAAgB;QACtB,4BAA4B;QAC5B,IAAI,CAAC,GAAG,CAAC,OAAO,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.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@intentsolutions/blueprint-chatbots",
3
+ "version": "2.0.0",
4
+ "description": "Slack and Discord integrations for Intent Blueprint Docs",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc",
13
+ "dev": "tsc --watch",
14
+ "clean": "rm -rf dist",
15
+ "test": "vitest",
16
+ "start:slack": "node dist/slack/app.js",
17
+ "start:discord": "node dist/discord/app.js"
18
+ },
19
+ "keywords": [
20
+ "slack",
21
+ "discord",
22
+ "chatbot",
23
+ "documentation",
24
+ "ai-tools"
25
+ ],
26
+ "author": "Jeremy Longshore <jeremy@intentsolutions.io>",
27
+ "license": "Apache-2.0",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/intent-solutions-io/intent-blueprint-docs.git",
31
+ "directory": "packages/chatbots"
32
+ },
33
+ "dependencies": {
34
+ "@intentsolutions/blueprint-core": "*",
35
+ "@slack/bolt": "^3.17.0",
36
+ "discord.js": "^14.14.0",
37
+ "nodemailer": "^6.9.0",
38
+ "archiver": "^6.0.0"
39
+ },
40
+ "devDependencies": {
41
+ "@types/node": "^20.0.0",
42
+ "@types/nodemailer": "^6.4.0",
43
+ "@types/archiver": "^6.0.0",
44
+ "typescript": "^5.3.0",
45
+ "vitest": "^1.0.0"
46
+ },
47
+ "engines": {
48
+ "node": ">=18.0.0"
49
+ }
50
+ }