-
Notifications
You must be signed in to change notification settings - Fork 3
feat: set up doc detective and verify onboarding wizard #275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "enabledPlugins": { | ||
| "doc-detective@doc-detective": true | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have more steps eg connect docs, configure triggers, adjust HLC etc