diff --git a/README.md b/README.md index 9992429..e69251e 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,10 @@ cp .env.example .env.local # Run Supabase migrations # (paste the SQL files from supabase/migrations/ into the Supabase SQL editor) +# Embed regulation text for the RAG pipeline +# (populates pgvector so AI scenarios can cite real regulation) +npm run embed:regulations + # Start dev server npm run dev ``` diff --git a/scripts/send-demo-slack.ts b/scripts/send-demo-slack.ts new file mode 100644 index 0000000..e8992b8 --- /dev/null +++ b/scripts/send-demo-slack.ts @@ -0,0 +1,36 @@ +// Post a sample training reminder to the configured Slack channel for demos. +// The button on the message links to /train/?demo=1 so anyone in the +// channel can click through without an account. +// +// Usage: +// npx tsx scripts/send-demo-slack.ts [moduleId] + +import { config as loadEnv } from 'dotenv' +loadEnv({ path: '.env.local' }) + +import { sendSlackReminder } from '@/lib/slackSender' +import { buildDeliveryContent } from '@/lib/delivery' + +async function main() { + const moduleId = process.argv[2] ?? process.env.SLACK_MODULE_ID + + if (!process.env.SLACK_BOT_TOKEN || !process.env.SLACK_CHANNEL_ID) { + console.error('Missing SLACK_BOT_TOKEN or SLACK_CHANNEL_ID in .env.local') + process.exit(1) + } + + const preview = buildDeliveryContent({ moduleId, demoMode: true }) + console.log(`Posting "${preview.module.title}" to channel ${process.env.SLACK_CHANNEL_ID}`) + console.log(`Training URL: ${preview.trainingUrl}`) + + const result = await sendSlackReminder({ moduleId, demoMode: true }) + if (!result.ok) { + console.error('Slack send failed:', result.error) + process.exit(1) + } + + console.log(`\nSent (ts=${result.ts}). Click the "Start training" button in Slack.`) + console.log(`Then open ${process.env.NEXT_PUBLIC_APP_URL ?? 'https://www.conply.org'}/admin to see the dashboard.`) +} + +main()