From 9417b293c0ebf7f43554c19f259d0b97bfc23261 Mon Sep 17 00:00:00 2001 From: Francis Roberts Date: Mon, 8 Jun 2026 21:43:47 +0200 Subject: [PATCH 1/2] Add Slack demo-message script Reads SLACK_BOT_TOKEN and SLACK_CHANNEL_ID from the environment. Co-Authored-By: Claude Opus 4.8 (1M context) --- scripts/send-demo-slack.ts | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 scripts/send-demo-slack.ts 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() From b676ebd875080a1dd4edd8e8ccf8abab8ea306e1 Mon Sep 17 00:00:00 2001 From: Francis Roberts Date: Thu, 11 Jun 2026 22:00:51 +0200 Subject: [PATCH 2/2] docs: add embed:regulations step to local setup The "Running locally" instructions jumped from migrations straight to the dev server, omitting the embedding step that populates pgvector. Without it the RAG pipeline returns no regulation context, so AI scenarios can't cite real law. Document the npm run embed:regulations step so a fresh clone works end-to-end. Co-Authored-By: Claude Opus 4.8 (1M context) --- README.md | 4 ++++ 1 file changed, 4 insertions(+) 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 ```