From 0b027366ad36a8f49695a1833f04509c9e38b140 Mon Sep 17 00:00:00 2001 From: Inline Pizza <249805557+InlinePizza@users.noreply.github.com> Date: Thu, 26 Feb 2026 14:48:22 -0800 Subject: [PATCH 1/2] feat: set up doc detective and verify onboarding wizard --- .claude/settings.json | 5 ++ .doc-detective.json | 23 +++++++ .doc-detective/.env.example | 4 ++ .doc-detective/extract-cookies.js | 67 +++++++++++++++++++ .doc-detective/tests/login.spec.json | 56 ++++++++++++++++ .gitignore | 5 ++ bootstrap.nu | 27 ++++++++ .../docs/getting-started/setup-quickstart.mdx | 11 ++- .../docs/integrations/slack-integration.mdx | 12 ++++ 9 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 .claude/settings.json create mode 100644 .doc-detective.json create mode 100644 .doc-detective/.env.example create mode 100644 .doc-detective/extract-cookies.js create mode 100644 .doc-detective/tests/login.spec.json create mode 100755 bootstrap.nu diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..a946f93 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,5 @@ +{ + "enabledPlugins": { + "doc-detective@doc-detective": true + } +} diff --git a/.doc-detective.json b/.doc-detective.json new file mode 100644 index 0000000..13c9e91 --- /dev/null +++ b/.doc-detective.json @@ -0,0 +1,23 @@ +{ + "input": [ + "src/content/docs/docs/integrations/slack-integration.mdx", + "src/content/docs/docs/getting-started/setup-quickstart.mdx" + ], + "output": ".doc-detective/results", + "recursive": true, + "origin": "https://promptless.ai", + "detectSteps": false, + "loadVariables": ".doc-detective/.env", + "beforeAny": ".doc-detective/tests/login.spec.json", + "runOn": [ + { + "platforms": ["mac"], + "browsers": [ + { + "name": "chrome", + "headless": false + } + ] + } + ] +} diff --git a/.doc-detective/.env.example b/.doc-detective/.env.example new file mode 100644 index 0000000..f2e4502 --- /dev/null +++ b/.doc-detective/.env.example @@ -0,0 +1,4 @@ +# Doc Detective test credentials +# Copy this to .env and fill in your test account values +PROMPTLESS_TEST_EMAIL=your-test-user@example.com +PROMPTLESS_TEST_PASSWORD=your-test-password diff --git a/.doc-detective/extract-cookies.js b/.doc-detective/extract-cookies.js new file mode 100644 index 0000000..99bafc7 --- /dev/null +++ b/.doc-detective/extract-cookies.js @@ -0,0 +1,67 @@ +#!/usr/bin/env node + +// Extract cookies from a running Chrome instance for Doc Detective. +// +// Usage: +// 1. Quit Chrome completely +// 2. Relaunch Chrome with remote debugging: +// /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 +// 3. Sign in to app.gopromptless.ai in that Chrome window +// 4. Run this script: node .doc-detective/extract-cookies.js +// +// This writes cookies in Netscape format to .doc-detective/session-cookies.txt +// which Doc Detective can load via the loadCookie action. + +const puppeteer = require('puppeteer-core'); +const fs = require('fs'); +const path = require('path'); + +const OUTPUT_PATH = path.join(__dirname, 'session-cookies.txt'); +const URLS = [ + 'https://app.gopromptless.ai', + 'https://accounts.gopromptless.ai', +]; + +async function extractCookies() { + let browser; + try { + browser = await puppeteer.connect({ browserURL: 'http://127.0.0.1:9222' }); + } catch (err) { + console.error('Could not connect to Chrome on port 9222.'); + console.error('Launch Chrome with: /Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --remote-debugging-port=9222'); + process.exit(1); + } + + const page = (await browser.pages())[0]; + + const allCookies = []; + for (const url of URLS) { + const cookies = await page.cookies(url); + allCookies.push(...cookies); + } + + // Deduplicate by name+domain + const seen = new Set(); + const unique = allCookies.filter((c) => { + const key = `${c.name}|${c.domain}`; + if (seen.has(key)) return false; + seen.add(key); + return true; + }); + + // Write Netscape cookie format + const lines = unique.map( + (c) => + `${c.domain}\tTRUE\t${c.path}\t${c.secure ? 'TRUE' : 'FALSE'}\t${Math.floor(c.expires)}\t${c.name}\t${c.value}` + ); + const content = '# Netscape HTTP Cookie File\n' + lines.join('\n') + '\n'; + fs.writeFileSync(OUTPUT_PATH, content); + + console.log(`Exported ${unique.length} cookies to ${OUTPUT_PATH}`); + browser.disconnect(); +} + +extractCookies().catch((err) => { + console.error('Error:', err.message); + process.exit(1); +}); diff --git a/.doc-detective/tests/login.spec.json b/.doc-detective/tests/login.spec.json new file mode 100644 index 0000000..9c9f36f --- /dev/null +++ b/.doc-detective/tests/login.spec.json @@ -0,0 +1,56 @@ +{ + "tests": [ + { + "testId": "clerk-login", + "description": "Sign in to Promptless with test credentials", + "steps": [ + { + "description": "Navigate to the sign-in page", + "goTo": "https://accounts.gopromptless.ai/sign-in" + }, + { + "description": "Click the email input", + "find": { + "selector": "#identifier-field", + "click": true + } + }, + { + "description": "Type the test email", + "type": "$PROMPTLESS_TEST_EMAIL" + }, + { + "description": "Click Continue after email", + "find": { + "selector": "button.cl-formButtonPrimary", + "click": true, + "timeout": 5000 + } + }, + { + "description": "Click the password input", + "find": { + "selector": "#password-field", + "click": true + } + }, + { + "description": "Type the test password", + "type": "$PROMPTLESS_TEST_PASSWORD" + }, + { + "description": "Click Continue to sign in", + "find": { + "selector": "button.cl-formButtonPrimary", + "click": true, + "timeout": 5000 + } + }, + { + "description": "Wait for sign-in to complete", + "wait": 5000 + } + ] + } + ] +} diff --git a/.gitignore b/.gitignore index d39fd91..91cc95d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,11 @@ # Dependencies /node_modules +# Doc Detective secrets and results +.doc-detective/.env +.doc-detective/session-cookies.txt +.doc-detective/results/ + # Production /build /dist diff --git a/bootstrap.nu b/bootstrap.nu new file mode 100755 index 0000000..61e2163 --- /dev/null +++ b/bootstrap.nu @@ -0,0 +1,27 @@ +#!/usr/bin/env nu + +# check .doc-detective/.env exists and has real values + +let f = ".doc-detective/.env" + +if not ($f | path exists) { + error make {msg: $"($f): no such file; cp .doc-detective/.env.example ($f) and edit"} +} + +let vars = (open $f + | lines + | where {|l| $l !~ '^\s*#' and $l =~ '='} + | each {|l| $l | parse "{k}={v}" | get 0} + | reduce -f {} {|it, acc| $acc | merge {($it.k): $it.v}} +) + +for want in [PROMPTLESS_TEST_EMAIL PROMPTLESS_TEST_PASSWORD] { + if $want not-in $vars { + error make {msg: $"($f): ($want) not set"} + } + if ($vars | get $want) in ["" "your-test-user@example.com" "your-test-password"] { + error make {msg: $"($f): ($want) still has placeholder value"} + } +} + +print "env ok" diff --git a/src/content/docs/docs/getting-started/setup-quickstart.mdx b/src/content/docs/docs/getting-started/setup-quickstart.mdx index 8d61ccc..6be6e28 100644 --- a/src/content/docs/docs/getting-started/setup-quickstart.mdx +++ b/src/content/docs/docs/getting-started/setup-quickstart.mdx @@ -8,14 +8,21 @@ sidebar: import HowItWorks from '@components/site/HowItWorks.astro'; import Success from '@components/fern/Success.astro'; -Promptless automatically updates your docs, saving your team time and improving your customer experience. +{/* test {"testId": "setup-quickstart-content"} */} +{/* step {"goTo": "https://promptless.ai/docs/getting-started/setup-quickstart"} */} +{/* step {"find": "Setup & Quickstart"} */} +Promptless automatically updates your docs, saving your team time and improving your customer experience. + +{/* step {"find": "Before You Start"} */} ## Before You Start Sign up for a free account at [accounts.gopromptless.ai](https://accounts.gopromptless.ai) +{/* step {"find": "Guided Setup Wizard"} */} ## Guided Setup Wizard +{/* step {"find": "Connect Slack"} */} When you first sign in, a 6-step wizard guides you through setup: Need help with integrations? Contact us at [help@gopromptless.ai](mailto:help@gopromptless.ai) - we add new integrations every week. +{/* test end */} diff --git a/src/content/docs/docs/integrations/slack-integration.mdx b/src/content/docs/docs/integrations/slack-integration.mdx index 882719c..8ffe461 100644 --- a/src/content/docs/docs/integrations/slack-integration.mdx +++ b/src/content/docs/docs/integrations/slack-integration.mdx @@ -8,6 +8,10 @@ sidebar: import Frame from '@components/fern/Frame.astro'; import Info from '@components/fern/Info.astro'; +{/* test {"testId": "slack-integration-content"} */} +{/* step {"goTo": "https://promptless.ai/docs/integrations/slack-integration"} */} +{/* step {"find": "Slack Integration"} */} + **Used for: Triggers and Context** Promptless integrates with Slack through our official Slack App, enabling automated documentation updates based on team communication and support conversations. @@ -16,8 +20,10 @@ Promptless does not archive or store your Slack messages. Disclaimer: Promptless uses LLMs from OpenAI and Anthropic that have the potential to generate inaccurate results. +{/* step {"find": "Installation"} */} ## Installation +{/* step {"checkLink": {"url": "https://app.gopromptless.ai/integrations"}} */} 1. Click "Connect Slack" from the [integrations page](https://app.gopromptless.ai/integrations). Integrations Page @@ -42,15 +48,21 @@ Disclaimer: Promptless uses LLMs from OpenAI and Anthropic that have the potenti Slack Integration Complete +{/* step {"find": "What You Can Do with Slack"} */} ## What You Can Do with Slack Once connected, you can use Slack for: +{/* step {"checkLink": {"url": "https://promptless.ai/docs/configuring-promptless/triggers/slack-messages"}} */} - **[Triggers](/docs/configuring-promptless/triggers/slack-messages)**: Tag @Promptless or use message actions to trigger documentation updates +{/* step {"checkLink": {"url": "https://promptless.ai/docs/configuring-promptless/context-sources"}} */} - **[Context Sources](/docs/configuring-promptless/context-sources)**: Search Slack conversations for team discussions and decisions +{/* step {"find": "Privacy and Channel Access"} */} ## Privacy and Channel Access By default, Promptless only reads Slack content when you explicitly trigger it by tagging @Promptless or using the "Update Docs" message action. If you enable passive listening in your project settings, Promptless will monitor only the specific channels you select. Promptless cannot access private channels unless it has been specifically invited to those channels. +{/* step {"checkLink": {"url": "https://promptless.ai/docs/how-to-use-promptless/working-with-slack"}} */} For more details about using Slack with Promptless, see [Working with Slack](/docs/how-to-use-promptless/working-with-slack). +{/* test end */} From 87bc55c668989478a29ca37ac9d2473752401a27 Mon Sep 17 00:00:00 2001 From: Inline Pizza <249805557+InlinePizza@users.noreply.github.com> Date: Thu, 26 Feb 2026 17:19:34 -0800 Subject: [PATCH 2/2] feat: add CI workflow with a perpeptually reset org --- .doc-detective.ci.json | 23 ++++++++++ .doc-detective/.env.example | 6 +++ .doc-detective/tests/login.spec.json | 13 +++++- .github/workflows/doc-detective.yml | 46 +++++++++++++++++++ scripts/reset_onboarding.nu | 35 ++++++++++++++ .../docs/getting-started/setup-quickstart.mdx | 10 ++++ 6 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 .doc-detective.ci.json create mode 100644 .github/workflows/doc-detective.yml create mode 100755 scripts/reset_onboarding.nu diff --git a/.doc-detective.ci.json b/.doc-detective.ci.json new file mode 100644 index 0000000..41eb2aa --- /dev/null +++ b/.doc-detective.ci.json @@ -0,0 +1,23 @@ +{ + "input": [ + "src/content/docs/docs/integrations/slack-integration.mdx", + "src/content/docs/docs/getting-started/setup-quickstart.mdx" + ], + "output": ".doc-detective/results", + "recursive": true, + "origin": "https://promptless.ai", + "detectSteps": false, + "loadVariables": ".doc-detective/.env", + "beforeAny": ".doc-detective/tests/login.spec.json", + "runOn": [ + { + "platforms": ["linux"], + "browsers": [ + { + "name": "chrome", + "headless": true + } + ] + } + ] +} diff --git a/.doc-detective/.env.example b/.doc-detective/.env.example index f2e4502..676c1f9 100644 --- a/.doc-detective/.env.example +++ b/.doc-detective/.env.example @@ -2,3 +2,9 @@ # Copy this to .env and fill in your test account values PROMPTLESS_TEST_EMAIL=your-test-user@example.com PROMPTLESS_TEST_PASSWORD=your-test-password + +# Promptless test org +PROMPTLESS_TEST_ORG_ID=org_xxxxx + +# Database connection for resetting onboarding state +DATABASE_URL=postgresql://user:pass@host:5432/dbname diff --git a/.doc-detective/tests/login.spec.json b/.doc-detective/tests/login.spec.json index 9c9f36f..3310608 100644 --- a/.doc-detective/tests/login.spec.json +++ b/.doc-detective/tests/login.spec.json @@ -4,6 +4,12 @@ "testId": "clerk-login", "description": "Sign in to Promptless with test credentials", "steps": [ + { + "description": "Reset onboarding state for test org", + "runShell": { + "command": "psql $DATABASE_URL -c \"UPDATE customer_info SET onboarding_completed = false, onboarding_info = '{}'::jsonb WHERE org_id = '$PROMPTLESS_TEST_ORG_ID';\"" + } + }, { "description": "Navigate to the sign-in page", "goTo": "https://accounts.gopromptless.ai/sign-in" @@ -27,11 +33,16 @@ "timeout": 5000 } }, + { + "description": "Wait for password page to load", + "wait": 3000 + }, { "description": "Click the password input", "find": { "selector": "#password-field", - "click": true + "click": true, + "timeout": 10000 } }, { diff --git a/.github/workflows/doc-detective.yml b/.github/workflows/doc-detective.yml new file mode 100644 index 0000000..d1f1ed5 --- /dev/null +++ b/.github/workflows/doc-detective.yml @@ -0,0 +1,46 @@ +name: doc-detective + +on: + workflow_dispatch: + +jobs: + doc-test: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - name: Install Nushell + run: | + curl -fsSL https://github.com/nushell/nushell/releases/latest/download/nu-linux-x86_64.tar.gz -o nu.tar.gz + tar -xzf nu.tar.gz + sudo mv nu-*/nu /usr/local/bin/ + rm -rf nu.tar.gz nu-* + + - name: Install dependencies + run: npm ci --no-audit --no-fund + + - name: Write test credentials + run: | + cat > .doc-detective/.env <