File size: 1,802 Bytes
ce72224
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env node

/**

 * Setup Script - Initialisiert ein neues Plugin

 * Nutzung: node scripts/create-plugin.js my-awesome-plugin

 */

const fs = require('fs')
const path = require('path')

const pluginName = process.argv[2]

if (!pluginName) {
  console.error('❌ Fehler: Plugin-Name erforderlich')
  console.log('Nutzung: node scripts/create-plugin.js my-plugin-name')
  process.exit(1)
}

const pluginDir = path.join(__dirname, '..', 'plugins')
const pluginFile = path.join(pluginDir, `${pluginName}.js`)

if (fs.existsSync(pluginFile)) {
  console.error(`❌ Plugin ${pluginName} existiert bereits!`)
  process.exit(1)
}

const template = `/**

 * Plugin: ${pluginName}

 * 

 * Automatisch generiert am: ${new Date().toISOString()}

 * 

 * Hooks:

 * - onPluginInit(context): Beim Plugin-Start

 * - onMessageSent(context, data): Wenn Benutzer Nachricht sendet

 * - onResponseReceived(context, data): Wenn Response kommt

 */



export function onPluginInit(context) {

  context.log('🎉 ${pluginName} plugin initialized!')

  

  // TODO: Plugin-Setup hier

}



export function onMessageSent(context, { message, systemPrompt }) {

  context.log(\`📤 Message: \${message.substring(0, 50)}...\`)

  

  // TODO: Message-Handler

}



export function onResponseReceived(context, { content, stats }) {

  context.log(\`📥 Response: \${content.substring(0, 50)}...\`)

  context.log(\`⏱️ Time: \${stats.time}s\`)

  

  // TODO: Response-Handler

}

`

fs.writeFileSync(pluginFile, template)

console.log(`✅ Plugin erstellt: ${pluginFile}`)
console.log(`\n🚀 Das Plugin wird automatisch geladen wenn die App startet!`)
console.log(`\n📝 Template-Datei: ${pluginFile}`)
console.log(`\n💡 Tipp: Öffne die Datei und füge deine Logik hinzu!`)