Auto-publish journey.yaml to Skene Cloud on first analysis - #85
Conversation
When analyse-journey runs with --auto-publish (set by the TUI when linked to a skene workspace), publish the freshly written journey.yaml to Skene Cloud iff no journey.yaml exists upstream yet. This stops first-time users from landing on an empty cloud canvas after following the visualization link to skene.ai. - upstream: add journey_exists_upstream() presence check (GET /journey/status); returns None on any indeterminate result so callers can skip safely. - push: extract publish_bundle() so the push command and the new auto-publish path build an identical manifest; refactor the push command onto it. - analyse-journey: add hidden --auto-publish flag + _maybe_auto_publish, gated on skene provider + linked workspace + definitive remote absence. Indeterminate/already-present results skip silently; failures never raise. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- test_upstream: cover journey_exists_upstream (exists true/false, non-200 and exceptions are indeterminate/None, missing field is falsey). - test_analyse_journey_auto_publish: cover the _maybe_auto_publish gating matrix (disabled, non-skene provider, missing upstream/token, already present, indeterminate, absent-so-publish) and that a publish failure does not raise. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extract analyse-journey arg building into journeyArgs() and append --auto-publish when the run is linked to a Skene workspace (skene provider + upstream URL + key). The flag marks this as a TUI-initiated, linked run; the CLI gates the actual push further on the journey being absent upstream. Add tests covering the linked case and the omit cases. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a stopgap note that first journey analysis from the TUI auto-publishes journey.yaml to Skene Cloud when none exists upstream: - push.md: new "Automatic first publish (journey analysis)" section. - quickstart.md: note in the upstream/deploy step linking to it. Fuller docs (analyse-journey command reference + a journey guide) tracked in #86. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 32c5d9aa36
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| return | ||
|
|
||
| try: | ||
| result = publish_bundle(project_root, config, upstream=upstream, token=token) |
There was a problem hiding this comment.
Publish the generated journey file, not config output dir
When TUI users have a custom output_dir, runUVX exports that value as SKENE_OUTPUT_DIR, but journeyArgs() still writes the generated journey to e.bundleOutputDir()/journey.yaml. This call then lets publish_bundle() collect files from config.output_dir, so the auto-publish can upload the wrong directory (or an empty payload) and report success while the freshly generated journey.yaml never reaches Skene Cloud. Pass the actual journey output path/directory through, or make the TUI and publisher use the same directory.
Useful? React with 👍 / 👎.
Summary
First-time Skene TUI users who link a workspace and run journey analysis land on an empty Customer Journey canvas after following the visualization's link to skene.ai (they haven't pushed
journey.yamlyet). This change auto-publishes the generatedjourney.yamlright after analysis, so the cloud canvas is populated by the time they click through.It only fires when both hold:
journey.yamlexists upstream yet.The gate is split between the TUI (knows it's linked) and the CLI (does the check + push):
tui/internal/services/growth/engine.go): extractedanalyse-journeyarg building intojourneyArgs(), which appends--auto-publishonly when linked (skene provider + upstream URL + key). The flag's presence marks a TUI-initiated, linked run.src/skene/cli/commands/analyse_journey.py): hidden--auto-publishflag +_maybe_auto_publish, gated on skene provider + linked workspace + definitive remote absence. Already-present or indeterminate results skip silently; a publish failure never fails analysis.src/skene/growth_loops/upstream.py):journey_exists_upstream()callsGET /api/v1/journey/status; returnsNoneon any indeterminate result (non-200, network error, endpoint not deployed) so callers can skip safely.src/skene/growth_loops/push.py): extractedpublish_bundle()so the existingpushcommand and the new auto-publish path build an identical manifest (no behavior change toskene push).Design decisions
skene analyse-journeyCLI runs never auto-publish, even when linked — it's gated on the flag the TUI sets.Dependency
Needs the dashboard endpoint
GET /api/v1/journey/status(SkeneTechnologies/skene-dashboard#200). Until that's deployed the presence check is indeterminate and auto-publish is a no-op, so this can merge/ship independently.Test Plan
Automated (run locally):
What the unit tests cover:
indeterminate, absent→publish; plus publish-failure-never-raises.
Manual end-to-end
Checklist
Cursor plugin updated (if commands, skills, or core CLI behavior changed)n/a