-
Notifications
You must be signed in to change notification settings - Fork 24
feat(self-driving): Add the self-driving program to set up PostHog Self-driving
#642
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
Open
sortafreel
wants to merge
43
commits into
main
Choose a base branch
from
feat/product-autonomy
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
1d25cc7
chore: add logs
sortafreel ae021a1
chore: logs
sortafreel 33c8e5c
fix: safer stringify
sortafreel 9b3f1b3
chore: more logs on the auth
sortafreel 2a597ca
chore: Simplify comments.
sortafreel 56a7d42
chore: Logs.
sortafreel 350fa16
fix: Ensure check MCP status properly (both locally and in prod).
sortafreel 6f1c211
fix: if require is unavailable - use replacement
sortafreel 100749c
fix(wizard-tools): make the ask adjacency nudge one-time so maxQuesti…
sortafreel ee82b2c
feat(programs): add product-autonomy program (wizard autonomy)
sortafreel 5781653
chore: autonomy plan
sortafreel af15908
chore: temp handoff
sortafreel 423f0f9
chore: collect project data into the context
sortafreel ffc3201
feat: allow checking external sources connection.
sortafreel 8ce44ab
feat: Allow creating custom scouts per product
sortafreel 2a00d83
feat: Fix clicking/copying long URLs from terminal.
sortafreel 99c7c29
feat: Docs.
sortafreel b2e857f
Merge branch 'main' into feat/product-autonomy
sortafreel cf185b4
fix: Simplify step 3.
sortafreel 3bc6cfa
chore: Docs.
sortafreel 9f57212
feat: Show custom tips/description for autonomy.,
sortafreel 66f61c3
chore: Docs.
sortafreel e709008
chore: Docs.
sortafreel 472f60e
chore: Docs.
sortafreel 847d2a4
chore: Docs
sortafreel 10a48ab
feat: Allow custom subtitles.
sortafreel 7d11f86
feat: Better communicate what's inbox and what to do next
sortafreel 2e258e8
feat: Simplify sources connection
sortafreel aae1ce6
chore: Rename to self-driving.
sortafreel f69d8d3
chore: Rename to self-driving.
sortafreel ff21a2d
feat: Add optional description to the multi-selection.
sortafreel 1f965ac
chore: Docs.
sortafreel 67c2826
fix: Remove excessive step.
sortafreel 2767064
fix: Remove temp files.
sortafreel 6889e1c
fix: no self-driving in signup-ci form.
sortafreel c117557
fix: Docs.
sortafreel 2284b55
fix: Do no require setup artefact.
sortafreel 5ba5c3c
fix: Guardrail.
sortafreel cff95f3
feat: Show outro.
sortafreel 83c97a0
fix: Increase timeout.
sortafreel 77b035e
fix: Skills.
sortafreel 04c1741
fix: Decrease self-driving sidebar tips waiting time.
sortafreel 273dcb6
Merge branch 'main' into feat/product-autonomy
sortafreel 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
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,75 @@ | ||
| import { | ||
| osc8Hyperlink, | ||
| extractUrls, | ||
| splitPromptIntoSegments, | ||
| } from '@ui/tui/primitives/link-helpers'; | ||
|
|
||
| const ESC = String.fromCharCode(0x1b); | ||
| const BEL = String.fromCharCode(0x07); | ||
| const LINEAR_URL = | ||
| 'http://localhost:8010/api/environments/1/integrations/authorize?kind=linear'; | ||
|
|
||
| describe('osc8Hyperlink', () => { | ||
| it('wraps the url in an OSC 8 escape, url as the default label', () => { | ||
| expect(osc8Hyperlink(LINEAR_URL)).toBe( | ||
| `${ESC}]8;;${LINEAR_URL}${BEL}${LINEAR_URL}${ESC}]8;;${BEL}`, | ||
| ); | ||
| }); | ||
|
|
||
| it('supports a custom label', () => { | ||
| expect(osc8Hyperlink('https://x.test', 'open')).toBe( | ||
| `${ESC}]8;;https://x.test${BEL}open${ESC}]8;;${BEL}`, | ||
| ); | ||
| }); | ||
| }); | ||
|
|
||
| describe('extractUrls', () => { | ||
| it('finds a single url', () => { | ||
| expect(extractUrls(`open ${LINEAR_URL} now`)).toEqual([LINEAR_URL]); | ||
| }); | ||
|
|
||
| it('returns [] when there is no url', () => { | ||
| expect(extractUrls('no links here')).toEqual([]); | ||
| }); | ||
|
|
||
| it('finds multiple urls', () => { | ||
| expect(extractUrls('a https://one.test and https://two.test')).toEqual([ | ||
| 'https://one.test', | ||
| 'https://two.test', | ||
| ]); | ||
| }); | ||
|
|
||
| it('strips trailing sentence punctuation', () => { | ||
| expect(extractUrls('see https://x.test.')).toEqual(['https://x.test']); | ||
| expect(extractUrls('(https://x.test)')).toEqual(['https://x.test']); | ||
| }); | ||
| }); | ||
|
|
||
| describe('splitPromptIntoSegments', () => { | ||
| it('breaks a standalone url line into its own segment, preserving spacing', () => { | ||
| const prompt = `One click connects Linear: open this link —\n\n${LINEAR_URL}\n\nThen come back here.`; | ||
| expect(splitPromptIntoSegments(prompt)).toEqual([ | ||
| { type: 'text', value: 'One click connects Linear: open this link —\n' }, | ||
| { type: 'url', value: LINEAR_URL }, | ||
| { type: 'text', value: '\nThen come back here.' }, | ||
| ]); | ||
| }); | ||
|
|
||
| it('returns a single text segment when there is no standalone url', () => { | ||
| expect(splitPromptIntoSegments('just some prose')).toEqual([ | ||
| { type: 'text', value: 'just some prose' }, | ||
| ]); | ||
| }); | ||
|
|
||
| it('keeps inline urls inside the text segment', () => { | ||
| expect(splitPromptIntoSegments('visit https://x.test for details')).toEqual( | ||
| [{ type: 'text', value: 'visit https://x.test for details' }], | ||
| ); | ||
| }); | ||
|
|
||
| it('handles a url-only prompt', () => { | ||
| expect(splitPromptIntoSegments(LINEAR_URL)).toEqual([ | ||
| { type: 'url', value: LINEAR_URL }, | ||
| ]); | ||
| }); | ||
| }); |
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,43 @@ | ||
| import { runWizard, runWizardCI } from '@lib/runners'; | ||
| import { selfDrivingConfig } from '@lib/programs/self-driving/index'; | ||
| import { skillProgramOptions } from './skill-program-options'; | ||
| import type { Command } from './command'; | ||
|
|
||
| export const selfDrivingCommand: Command = { | ||
| name: 'self-driving', | ||
| description: selfDrivingConfig.description, | ||
| options: { | ||
| ...skillProgramOptions, | ||
| ...(selfDrivingConfig.cliOptions ?? {}), | ||
| }, | ||
| check: (argv) => { | ||
| // self-driving builds on an existing integration and is fully interactive, | ||
| // so the modes that break it are rejected before the TUI/agent loop spins | ||
| // up rather than failing late (a 403 on the first MCP probe under --signup, | ||
| // or a stalled `wizard_ask` with no bridge under --ci). | ||
| if (argv.signup) { | ||
| throw new Error( | ||
| '`self-driving` cannot run with --signup. It builds on an existing ' + | ||
| 'PostHog integration — run the base `wizard` to create your account ' + | ||
| 'and set up PostHog first, then run `wizard self-driving`.', | ||
| ); | ||
| } | ||
| if (argv.ci) { | ||
| throw new Error( | ||
| '`self-driving` cannot run in CI mode — it requires interactive steps ' + | ||
| '(GitHub connect, issue-tracker selection, custom-scout approval).', | ||
| ); | ||
| } | ||
| return true; | ||
| }, | ||
| handler: (argv) => { | ||
| const extras = | ||
| selfDrivingConfig.mapCliOptions?.(argv as Record<string, unknown>) ?? {}; | ||
| const options = { ...argv, ...extras }; | ||
| if (options.ci) { | ||
| runWizardCI(selfDrivingConfig, options); | ||
| } else { | ||
| runWizard(selfDrivingConfig, options); | ||
| } | ||
| }, | ||
| }; | ||
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.