showpane 0.4.13 → 0.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +2 -1
  2. package/bundle/meta/scaffold-manifest.json +10 -10
  3. package/bundle/scaffold/VERSION +1 -1
  4. package/bundle/scaffold/prisma/seed.ts +40 -35
  5. package/bundle/scaffold/src/__tests__/portal-contracts.test.ts +7 -0
  6. package/bundle/scaffold/src/app/(portal)/client/example/example-client.tsx +1 -2
  7. package/bundle/scaffold/src/app/(portal)/client/page.tsx +5 -4
  8. package/bundle/scaffold/src/app/page.tsx +43 -6
  9. package/bundle/scaffold/src/components/portal-shell.tsx +23 -0
  10. package/bundle/scaffold/src/lib/portal-contracts.ts +33 -0
  11. package/bundle/toolchain/CLI_VERSION +1 -0
  12. package/bundle/toolchain/TELEMETRY_CONFIG.json +4 -0
  13. package/bundle/toolchain/VERSION +1 -1
  14. package/bundle/toolchain/bin/ensure-cloud-project-link.ts +34 -1
  15. package/bundle/toolchain/bin/showpane-config +108 -29
  16. package/bundle/toolchain/bin/showpane-telemetry-log +84 -0
  17. package/bundle/toolchain/bin/showpane-telemetry-sync +212 -0
  18. package/bundle/toolchain/bin/showpane-update-check +130 -0
  19. package/bundle/toolchain/skills/SKILL.md.tmpl +13 -0
  20. package/bundle/toolchain/skills/VERSION +1 -1
  21. package/bundle/toolchain/skills/portal-analytics/SKILL.md +60 -38
  22. package/bundle/toolchain/skills/portal-analytics/SKILL.md.tmpl +192 -0
  23. package/bundle/toolchain/skills/portal-create/SKILL.md +65 -67
  24. package/bundle/toolchain/skills/portal-create/SKILL.md.tmpl +264 -0
  25. package/bundle/toolchain/skills/portal-credentials/SKILL.md +66 -49
  26. package/bundle/toolchain/skills/portal-credentials/SKILL.md.tmpl +198 -0
  27. package/bundle/toolchain/skills/portal-delete/SKILL.md +63 -41
  28. package/bundle/toolchain/skills/portal-delete/SKILL.md.tmpl +194 -0
  29. package/bundle/toolchain/skills/portal-deploy/SKILL.md +57 -47
  30. package/bundle/toolchain/skills/portal-deploy/SKILL.md.tmpl +452 -0
  31. package/bundle/toolchain/skills/portal-dev/SKILL.md +65 -47
  32. package/bundle/toolchain/skills/portal-dev/SKILL.md.tmpl +228 -0
  33. package/bundle/toolchain/skills/portal-list/SKILL.md +64 -43
  34. package/bundle/toolchain/skills/portal-list/SKILL.md.tmpl +181 -0
  35. package/bundle/toolchain/skills/portal-onboard/SKILL.md +331 -162
  36. package/bundle/toolchain/skills/portal-onboard/SKILL.md.tmpl +340 -0
  37. package/bundle/toolchain/skills/portal-preview/SKILL.md +65 -44
  38. package/bundle/toolchain/skills/portal-preview/SKILL.md.tmpl +171 -0
  39. package/bundle/toolchain/skills/portal-setup/SKILL.md +79 -60
  40. package/bundle/toolchain/skills/portal-setup/SKILL.md.tmpl +227 -0
  41. package/bundle/toolchain/skills/portal-share/SKILL.md +69 -47
  42. package/bundle/toolchain/skills/portal-share/SKILL.md.tmpl +162 -0
  43. package/bundle/toolchain/skills/portal-status/SKILL.md +58 -37
  44. package/bundle/toolchain/skills/portal-status/SKILL.md.tmpl +196 -0
  45. package/bundle/toolchain/skills/portal-update/SKILL.md +60 -46
  46. package/bundle/toolchain/skills/portal-update/SKILL.md.tmpl +269 -0
  47. package/bundle/toolchain/skills/portal-upgrade/SKILL.md +55 -33
  48. package/bundle/toolchain/skills/portal-upgrade/SKILL.md.tmpl +164 -0
  49. package/bundle/toolchain/skills/portal-verify/SKILL.md +69 -14
  50. package/bundle/toolchain/skills/portal-verify/SKILL.md.tmpl +224 -0
  51. package/bundle/toolchain/skills/shared/preamble.md +30 -126
  52. package/bundle/toolchain/skills/shared/runtime-principles.md +25 -0
  53. package/bundle/toolchain/templates/sales-followup/sales-followup-client.tsx +1 -1
  54. package/dist/index.js +79 -14
  55. package/package.json +5 -2
@@ -1,46 +1,50 @@
1
1
  ---
2
2
  name: portal-onboard
3
3
  description: |
4
- Guided first-run experience that chains setup, create, credentials, and preview.
5
- Use when asked to "get started", "onboard", "first time setup", "walk me through",
6
- or "set up showpane from scratch". (showpane)
4
+ Canonical first-run wizard for Showpane. Use this for the first portal, for
5
+ guided onboarding, or any "walk me through it" request. It owns the end-to-end
6
+ first-run story: local setup, draft creation, preview, access setup, and the
7
+ hosted publish handoff. (showpane)
7
8
  allowed-tools: [Bash, Read, Write, Edit, Glob, Grep]
8
9
  ---
9
10
 
10
11
  ## Preamble (run first)
11
12
 
12
- Before doing anything else, execute this block in a Bash tool call:
13
+ Before doing anything else, execute this block in a Bash tool call.
14
+
15
+ This preamble is intentionally tolerant of first-run state. It must not fail just because `~/.showpane/config.json` does not exist yet.
13
16
 
14
17
  ```bash
15
- CONFIG="$HOME/.showpane/config.json"
16
- if [ ! -f "$CONFIG" ]; then
17
- echo "Showpane not configured. Run /portal setup first."
18
- exit 1
18
+ SHOWPANE_HOME="$HOME/.showpane"
19
+ SHOWPANE_BIN="$SHOWPANE_HOME/bin"
20
+ CONFIG="$SHOWPANE_HOME/config.json"
21
+ APP_PATH=""
22
+ DEPLOY_MODE="local"
23
+ ORG_SLUG=""
24
+ CONFIG_PRESENT=false
25
+
26
+ if [ -f "$CONFIG" ]; then
27
+ CONFIG_PRESENT=true
28
+ APP_PATH=$(python3 -c "import json; d=json.load(open('$CONFIG')); print(d.get('app_path',''))" 2>/dev/null || true)
29
+ DEPLOY_MODE=$(python3 -c "import json; d=json.load(open('$CONFIG')); print(d.get('deploy_mode','local'))" 2>/dev/null || echo "local")
30
+ ORG_SLUG=$(python3 -c "import json; d=json.load(open('$CONFIG')); print(d.get('orgSlug','') or d.get('org_slug',''))" 2>/dev/null || true)
19
31
  fi
20
- APP_PATH=$(cat "$CONFIG" | python3 -c "import sys,json; print(json.loads(sys.stdin.read()).get('app_path',''))" 2>/dev/null)
21
- DEPLOY_MODE=$(cat "$CONFIG" | python3 -c "import sys,json; print(json.loads(sys.stdin.read()).get('deploy_mode','local'))" 2>/dev/null)
22
- ORG_SLUG=$(cat "$CONFIG" | python3 -c "import sys,json; d=json.loads(sys.stdin.read()); print(d.get('orgSlug','') or d.get('org_slug',''))" 2>/dev/null)
32
+
23
33
  APP_PATH="${SHOWPANE_APP_PATH:-$APP_PATH}"
24
- if [ -f "$APP_PATH/.env" ]; then set -a && source "$APP_PATH/.env" && set +a; fi
25
- DATABASE_URL="${DATABASE_URL:-}"
26
- if [ ! -d "$APP_PATH/node_modules/.prisma" ]; then
27
- echo "App dependencies not installed. Run: cd $APP_PATH && npm install"
28
- exit 1
29
- fi
30
- SKILL_DIR="${SHOWPANE_TOOLCHAIN_DIR:-$HOME/.showpane/current}"
34
+ SKILL_DIR="${SHOWPANE_TOOLCHAIN_DIR:-$SHOWPANE_HOME/current}"
31
35
  SKILL_VERSION=$(cat "$SKILL_DIR/VERSION" 2>/dev/null || echo "unknown")
32
- echo "SHOWPANE: v$SKILL_VERSION | MODE: $DEPLOY_MODE | APP: $APP_PATH"
33
- LEARN_FILE="$HOME/.showpane/learnings.jsonl"
34
- [ -f "$LEARN_FILE" ] && echo "LEARNINGS: $(wc -l < "$LEARN_FILE" | tr -d ' ') loaded" || echo "LEARNINGS: 0"
35
-
36
- # Predictive next-skill suggestion
37
- if [ -f "$HOME/.showpane/timeline.jsonl" ]; then
38
- _RECENT=$(grep '"event":"completed"' "$HOME/.showpane/timeline.jsonl" 2>/dev/null | tail -3 | grep -o '"skill":"[^"]*"' | sed 's/"skill":"//;s/"//' | tr '\n' ',' | sed 's/,$//' || true)
39
- [ -n "$_RECENT" ] && echo "RECENT_SKILLS: $_RECENT"
40
- fi
41
-
42
- # Search relevant learnings
43
- LEARN_FILE="$HOME/.showpane/learnings.jsonl"
36
+ CHECKPOINT="$SHOWPANE_HOME/checkpoints/portal-onboard.json"
37
+ _UPD=$("$SHOWPANE_BIN/showpane-update-check" 2>/dev/null || true)
38
+ [ -n "$_UPD" ] && echo "$_UPD" || true
39
+ mkdir -p "$SHOWPANE_HOME/sessions" "$SHOWPANE_HOME/analytics" "$SHOWPANE_HOME/checkpoints"
40
+ touch "$SHOWPANE_HOME/sessions/$PPID"
41
+ find "$SHOWPANE_HOME/sessions" -mmin +120 -type f -delete 2>/dev/null || true
42
+ TEL=$("$SHOWPANE_BIN/showpane-config" get telemetry 2>/dev/null || echo "anonymous")
43
+ TEL_PROMPTED=$([ -f "$SHOWPANE_HOME/.telemetry-prompted" ] && echo "yes" || echo "no")
44
+ _TEL_START=$(date +%s)
45
+ _SESSION_ID="${PPID:-0}-$(date +%s)"
46
+
47
+ LEARN_FILE="$SHOWPANE_HOME/learnings.jsonl"
44
48
  if [ -f "$LEARN_FILE" ]; then
45
49
  _LEARN_COUNT=$(wc -l < "$LEARN_FILE" 2>/dev/null | tr -d ' ')
46
50
  echo "LEARNINGS: $_LEARN_COUNT entries"
@@ -49,229 +53,394 @@ if [ -f "$LEARN_FILE" ]; then
49
53
  tail -5 "$LEARN_FILE" 2>/dev/null
50
54
  fi
51
55
  fi
56
+ if [ -f "$SHOWPANE_HOME/timeline.jsonl" ]; then
57
+ _RECENT=$(grep '"event":"completed"' "$SHOWPANE_HOME/timeline.jsonl" 2>/dev/null | tail -3 | grep -o '"skill":"[^"]*"' | sed 's/"skill":"//;s/"//' | tr '
58
+ ' ',' | sed 's/,$//' || true)
59
+ [ -n "$_RECENT" ] && echo "RECENT_SKILLS: $_RECENT"
60
+ fi
61
+
62
+ if [ -n "$APP_PATH" ] && [ -f "$APP_PATH/.env" ]; then
63
+ set -a && source "$APP_PATH/.env" && set +a
64
+ fi
52
65
 
53
- # Track skill execution
54
- SHOWPANE_TIMELINE="$HOME/.showpane/timeline.jsonl"
66
+ SHOWPANE_TIMELINE="$SHOWPANE_HOME/timeline.jsonl"
55
67
  mkdir -p "$(dirname "$SHOWPANE_TIMELINE")"
56
68
  echo '{"skill":"portal-onboard","event":"started","ts":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"}' >> "$SHOWPANE_TIMELINE" 2>/dev/null
69
+ echo "SHOWPANE: v$SKILL_VERSION | MODE: $DEPLOY_MODE"
70
+ echo "CONFIG_PRESENT: $CONFIG_PRESENT"
71
+ echo "APP_PATH: ${APP_PATH:-missing}"
72
+ echo "ORG_SLUG: ${ORG_SLUG:-missing}"
73
+ echo "TELEMETRY: $TEL"
74
+ echo "TEL_PROMPTED: $TEL_PROMPTED"
75
+ if [ -f "$CHECKPOINT" ]; then
76
+ echo "CHECKPOINT_PRESENT: true"
77
+ echo "CHECKPOINT_DATA:"
78
+ cat "$CHECKPOINT"
79
+ else
80
+ echo "CHECKPOINT_PRESENT: false"
81
+ fi
82
+ ```
83
+
84
+ If output shows `JUST_UPGRADED <from> <to>`, tell the user Showpane was just upgraded and continue.
85
+
86
+ If output shows `UPGRADE_AVAILABLE <old> <new>`, tell the user a newer Showpane toolchain is available and recommend `/portal-upgrade`.
87
+
88
+ If `TEL_PROMPTED` is `no`, default telemetry to `anonymous` without interrupting the flow. Do not mention telemetry unless the user asks.
89
+
90
+ Run:
91
+ ```bash
92
+ "$SHOWPANE_BIN/showpane-config" set telemetry anonymous
93
+ touch "$SHOWPANE_HOME/.telemetry-prompted"
57
94
  ```
58
95
 
59
- If RECENT_SKILLS is shown, suggest the likely next skill:
96
+ If `RECENT_SKILLS` is shown, suggest the likely next skill:
60
97
  - After portal-create → suggest /portal-preview
61
- - After portal-preview → suggest /portal-deploy or /portal-share
98
+ - After portal-preview → suggest /portal-deploy
62
99
  - After portal-deploy → suggest /portal-status or /portal-verify
63
- - After portal-setup → suggest /portal-create
64
- - After portal-credentials → suggest /portal-share
65
- - After portal-update → suggest /portal-deploy
100
+ - After portal-setup → suggest /portal-onboard for a first run, or /portal-create for the fast path
101
+ - After portal-credentials → suggest /portal-deploy before external sharing
102
+ - After portal-update → suggest /portal-preview or /portal-deploy
103
+
104
+ If `RECENT_LEARNINGS` is shown, review them before proceeding. Apply them where relevant but do not mention them unless they materially affect the current task.
66
105
 
67
- If RECENT_LEARNINGS is shown, review them before proceeding. Past learnings may contain
68
- relevant warnings or tips for this operation. Apply them where relevant but don't
69
- mention them unless they directly affect the current task.
106
+ Read `skills/shared/runtime-principles.md` once near the start of the skill and apply the relevant product defaults.
107
+
108
+ If `skills/shared/platform-constraints.md` exists, read it once near the start of the skill and apply only the relevant limits.
70
109
 
71
110
  ## Overview
72
111
 
73
- This skill is the guided first-run experience for Showpane. It chains four other skills together in sequence -- setup, create, credentials, and preview -- walking the user through each step with clear transitions. The goal is to go from zero to a working portal in the browser in under 5 minutes.
112
+ `/portal-onboard` is the canonical first-run workflow. It should feel like one
113
+ coherent wizard, not like the user is manually hopping between separate skills.
114
+
115
+ The recommended shape is:
74
116
 
75
- This is specifically designed for users who have just installed Showpane and want to see it working end-to-end. It is opinionated about the order of operations and provides more context and encouragement than the individual skills would on their own.
117
+ 1. orient the user
118
+ 2. verify local setup
119
+ 3. choose the best source for the first draft
120
+ 4. create the portal draft
121
+ 5. make one or two practical refinements
122
+ 6. preview locally
123
+ 7. choose how the client will access it
124
+ 8. publish to Showpane Cloud
125
+ 9. show a compact final summary
76
126
 
77
- The onboard flow is linear. Each step depends on the previous one completing successfully. If any step fails, the flow stops and provides recovery instructions rather than skipping ahead.
127
+ Keep the tone direct and calm. Use short phase transitions. Re-ground the user at
128
+ each phase so they always know what is happening next.
78
129
 
79
- ## Steps
130
+ ## Interaction Style
80
131
 
81
- ### Step 1: Welcome message
132
+ For decisions that materially change the flow, use recommendation-first language.
133
+ The pattern should look like this:
82
134
 
83
- Start with a welcome that sets expectations. First, display the ASCII welcome banner:
135
+ 1. one sentence re-grounding the current phase
136
+ 2. one sentence on the recommended choice and why
137
+ 3. a short list of concrete options
138
+
139
+ Example:
140
+
141
+ `We have local setup ready. Next we need the best source for your first draft.`
142
+
143
+ `Recommended: use a real transcript if you have one — it gives the strongest first portal on the first pass.`
144
+
145
+ `Options: recent Granola meeting, pasted transcript, short description, or start from template.`
146
+
147
+ Do not ask more than one meaningful question at a time unless the answers are tightly coupled.
148
+
149
+ ## Wizard Phases
150
+
151
+ ### Phase 0: Resume or restart
152
+
153
+ If a checkpoint exists:
154
+
155
+ - show the saved phase and portal slug if present
156
+ - recommend resume
157
+ - if the user restarts, delete the checkpoint and begin from Phase 1
158
+
159
+ ### Phase 1: Orientation
160
+
161
+ Start with a compact welcome:
84
162
 
85
163
  ```
86
164
  ╔══════════════════════════════════════════╗
87
- ║ SHOWPANE — Client Portal Generator
165
+ ║ SHOWPANE — First Portal Wizard
88
166
  ╚══════════════════════════════════════════╝
89
167
  ```
90
168
 
91
- Then continue with:
169
+ Then use one short, friendly paragraph. Keep it concise and informal.
170
+
171
+ Suggested shape:
172
+
173
+ - "Let's get your first portal started."
174
+ - "Who's it for, and what's the context? If you've got a call transcript, paste it in and I'll use that too."
175
+
176
+ Keep the opening focused on the user's first portal. This skill is the first-run default, so the top of the flow should feel fast, calm, and immediately useful.
177
+
178
+ Immediately save checkpoint:
179
+
180
+ ```bash
181
+ mkdir -p "$HOME/.showpane/checkpoints"
182
+ printf '%s\n' '{"phase":"orientation","startedAt":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"}' > "$HOME/.showpane/checkpoints/portal-onboard.json"
183
+ ```
184
+
185
+ ### Phase 2: Local readiness
186
+
187
+ If `CONFIG_PRESENT: false`, run the `portal-setup` flow inline.
92
188
 
93
- "Welcome to Showpane! Let's set up your first client portal. This will take about 5 minutes and we'll go through four steps:
189
+ If config exists, verify only the minimum first-run requirements before continuing:
94
190
 
95
- 1. Configure Showpane (app path, database, organization)
96
- 2. Create your first portal
97
- 3. Set up login credentials
98
- 4. Open it in your browser
191
+ - app path exists
192
+ - dependencies exist or can be installed
193
+ - local SQLite schema is ready
194
+ - org exists or can be created
99
195
 
100
- Let's get started."
196
+ Keep this phase minimal.
101
197
 
102
- This framing is important. It tells the user what to expect and roughly how long it will take. Uncertainty causes drop-off.
198
+ If the local checks pass, move straight into the user's portal work without extra system narration.
103
199
 
104
- ### Step 2: Run the setup flow
200
+ If there is already exactly one local organization and it clearly matches the
201
+ workspace the user just created, treat the org basics as already captured.
202
+ Do not create a separate "company context" phase just to re-ask the same setup
203
+ details.
105
204
 
106
- Read the instructions from `skills/portal-setup/SKILL.md` and execute the setup flow inline. This means you follow the setup skill's instructions as if the user had run `/portal setup` directly.
205
+ Only ask for a missing field, and ask exactly one thing at a time.
107
206
 
108
- The setup flow will:
109
- - Detect the app path (or ask the user)
110
- - Verify the database connection
111
- - Create or select an organization
112
- - Write the config to `~/.showpane/config.json`
113
- - Set file permissions
207
+ Recommended order for missing fields:
114
208
 
115
- During setup, also ask for the company's website URL (e.g., "acme.com"). This is used for auto-branding:
116
- - Fetch the company logo via `getLogoUrl(domain)` from `app/src/lib/branding.ts`
117
- - The logo URL will be stored in the Organization record's `logoUrl` field
118
- - If the user doesn't have a website, skip — the initial-based fallback works fine
209
+ 1. organization name, if it is not already obvious from the workspace setup
210
+ 2. contact email
211
+ 3. website/domain
119
212
 
120
- Also ask for the contact's email address and use `getAvatarUrl(email, contactName)` to auto-populate the contact avatar.
213
+ Do not batch these into a numbered questionnaire unless the user explicitly asks
214
+ for the full checklist.
121
215
 
122
- **Important**: If setup detects that Showpane is already configured (config file exists, database is connected, org exists), acknowledge it and skip to the next step: "Showpane is already configured. Skipping setup."
216
+ Optional extras like brand color, phone number, or contact title belong in
217
+ `/portal-setup` later if needed.
123
218
 
124
- If setup fails at any point (database not reachable, app not found), stop the onboard flow and provide clear instructions: "Setup needs to be completed before we can continue. Fix the issue above and run /portal onboard again."
219
+ If setup fails, stop with a concrete recovery step and keep the checkpoint.
125
220
 
126
- After successful setup, transition:
221
+ Save checkpoint with phase `local-ready`.
127
222
 
128
- "Setup complete! Your Showpane instance is configured. Let's create your first portal."
223
+ ### Phase 3: Choose the first-portal source
129
224
 
130
- ### Granola MCP Integration
225
+ Start with one short source question, not a menu.
131
226
 
132
- After setup, check if Granola MCP tools are available by attempting to call `list_meetings`.
227
+ Recommended opening:
133
228
 
134
- If available:
135
- - Show: "I found your Granola meetings. Want to use a recent call as the source for your first portal?"
136
- - List recent meetings with date + title
137
- - If selected, use the transcript to pre-populate portal content
229
+ - "Who's it for, and what's the context? If you've got a call transcript, paste it in and I'll use that too."
138
230
 
139
- If not available:
140
- - Skip silently. Do not mention Granola or show an error.
231
+ Only branch after the user answers:
141
232
 
142
- ### Step 3: Run the create flow
233
+ - if they have a real transcript, ask whether to use Granola or paste it
234
+ - if they do not, ask whether they want to start from notes or a template
143
235
 
144
- Read the instructions from `skills/portal-create/SKILL.md` and execute the create flow inline. This creates the portal page files and database record.
236
+ Only show the full menu if the user is unsure:
145
237
 
146
- During onboarding, provide a bit more guidance than the standalone create skill would:
238
+ 1. recent Granola meeting
239
+ 2. pasted transcript
240
+ 3. short description of the client + meeting outcome
241
+ 4. template-only start
147
242
 
148
- - Suggest a slug if the user is unsure: "Pick a short name for the portal URL, like your client's company name in lowercase. For example: 'acme' or 'whzan'."
149
- - If the user has Granola MCP connected, offer to pull a recent meeting as the source material. If not, prompt for a brief description of the client and what the portal should contain.
150
- - Use the sales-followup template as the default suggestion for first-time users: "We'll use the sales follow-up template as a starting point. You can customize everything after."
243
+ If Granola MCP is unavailable, skip it silently and move on.
151
244
 
152
- After successful creation, transition:
245
+ If the user only has a rough brief, recommend `sales-followup` as the default
246
+ template for the first portal unless the engagement is clearly onboarding or consulting.
153
247
 
154
- "Great! Portal '<slug>' created for <company>. Now let's set up credentials so your client can log in."
248
+ Save checkpoint with:
155
249
 
156
- If creation fails (e.g., slug already taken), help the user pick a different slug and retry. Do not abort the entire onboard flow for a recoverable error.
250
+ - `phase: "source-selected"`
251
+ - `sourceType`
252
+ - `template`
157
253
 
158
- ### Step 4: Run the credentials flow
254
+ ### Phase 4: Create the first draft
159
255
 
160
- Read the instructions from `skills/portal-credentials/SKILL.md` and execute the credentials flow inline. This creates a username and password for the portal.
256
+ Run the `portal-create` flow inline, but frame it as part of the wizard, not as
257
+ a separate command.
161
258
 
162
- During onboarding, the credentials flow is straightforward -- generate initial credentials. There is no rotation to handle on first run.
259
+ During this phase:
163
260
 
164
- After credentials are generated, display them clearly:
261
+ - suggest a slug if needed
262
+ - prefer a real company/client name in the portal
263
+ - prefer useful structure over completeness
264
+ - aim for a credible first draft, not a perfect final artifact
165
265
 
166
- "Credentials created. Save these -- they are shown once:
266
+ If the slug is taken, treat that as a soft retry, not a failure.
167
267
 
168
- Username: <username>
169
- Password: <password>
268
+ Save checkpoint with:
170
269
 
171
- You'll share these with your client (or use /portal share to generate a link instead)."
270
+ - `phase: "draft-created"`
271
+ - `portalSlug`
272
+ - `companyName`
172
273
 
173
- Transition to the final step:
274
+ ### Phase 5: Practical refinements
174
275
 
175
- "Almost done! Let's open your portal in the browser."
276
+ Do not ask the user to invent a whole redesign. Ask for one or two high-signal refinements only.
176
277
 
177
- ### Step 5: Run the preview flow
278
+ Recommended refinement prompts:
178
279
 
179
- Read the instructions from `skills/portal-preview/SKILL.md` and execute the preview flow inline. This opens the portal in the user's default browser.
280
+ - `Do you want the portal to feel more concise, more sales-focused, or more delivery-focused?`
281
+ - `Should we add anything practical before preview — timeline, documents, or sharper next steps?`
180
282
 
181
- During onboarding, add a note about what the user will see:
283
+ Apply the requested refinement inline, using the same patterns as `/portal-update`
284
+ without forcing the user to switch skills.
182
285
 
183
- "Opening your portal now. You'll see a login page. Use the credentials above to log in, or just review the page to make sure everything looks right."
286
+ If the user is happy with the first draft, move on immediately.
184
287
 
185
- If no dev server is running, start one: "The dev server isn't running. Let me start it for you." Then run the dev server startup (from `/portal dev` instructions) and wait for it to be ready before opening the browser.
288
+ Save checkpoint with phase `draft-refined`.
186
289
 
187
- After the browser opens, transition to the final summary.
290
+ ### Phase 6: Local preview
188
291
 
189
- ### Step 6: Final summary
292
+ Run the `portal-preview` flow inline.
190
293
 
191
- Display the completion summary in an ASCII box:
294
+ If no dev server is running, start it using the `portal-dev` instructions first.
295
+
296
+ Tell the user exactly what to inspect:
297
+
298
+ - does the overall story feel right?
299
+ - are next steps clear?
300
+ - are obvious documents or dates missing?
301
+
302
+ If the user requests a small content fix after preview, make it and preview again.
303
+ Keep this loop tight. Do not let it become an open-ended editing session.
304
+
305
+ Save checkpoint with phase `previewed`.
306
+
307
+ ### Phase 7: Access setup
308
+
309
+ Ask how the client should access the hosted portal after publish.
310
+
311
+ Recommended first-run choice:
312
+
313
+ - publish first, then choose the hosted access method
314
+ - keep credentials available as the default fallback
315
+
316
+ Important rule: share links still require portal credentials to exist, because
317
+ share links are tied to credential versioning.
318
+
319
+ So the flow is:
320
+
321
+ 1. run `portal-credentials` inline
322
+ 2. show the credentials once
323
+ 3. explain that external sharing starts with `portal-deploy`
324
+ 4. if the user wants a direct hosted access link after publish, plan to run `portal-share`
325
+
326
+ Never write the password into the checkpoint or learnings.
327
+
328
+ Save checkpoint with phase `access-ready` and `accessMode`.
329
+
330
+ ### Phase 8: Publish to Showpane Cloud
331
+
332
+ Run the `portal-deploy` flow inline.
333
+
334
+ This phase is part of onboarding by default. Do not treat publish as an optional
335
+ afterthought unless the user explicitly says they want to stop at local preview.
336
+
337
+ If cloud auth is missing:
338
+
339
+ - tell the user to run `showpane login`
340
+ - after login completes, resume from the checkpoint
341
+
342
+ If deploy returns `organization_required`:
343
+
344
+ - explain that the user needs to start billing/workspace creation in Showpane Cloud
345
+ - send them to checkout
346
+ - resume after checkout
347
+
348
+ If deploy returns `organization_not_ready`:
349
+
350
+ - surface the readiness detail directly
351
+ - distinguish between:
352
+ - billing inactive
353
+ - provisioning still running
354
+ - provisioning unhealthy/failed
355
+ - workspace incomplete
356
+ - send the user to the relevant settings or checkout action
357
+ - keep the checkpoint so they can resume publish instead of restarting the wizard
358
+
359
+ If publish succeeds and the user wants a hosted direct-access link, run `portal-share` inline next.
360
+
361
+ Save checkpoint with phase `published` once the hosted URL is live or clearly accepted for publish.
362
+
363
+ ### Phase 9: Final summary
364
+
365
+ Show a compact final reference card:
192
366
 
193
367
  ```
194
368
  ════════════════════════════════════════
195
- Showpane is ready!
196
-
369
+ First portal complete
370
+
197
371
  Portal: <slug> (<company>)
198
- URL: http://localhost:3000/client/<slug>
199
- Username: <username>
200
-
201
- Next: /portal deploy to go live
202
- Help: /portal list, /portal status
372
+ Local: http://localhost:3000/client/<slug>
373
+ Cloud: <hosted-url-or-publishing-status>
374
+ Access: <hosted login / hosted share link / both>
375
+
376
+ Next: /portal-update <slug>
377
+ Help: /portal-list, /portal-status
203
378
  ════════════════════════════════════════
204
379
  ```
205
380
 
206
- Note: Do NOT include the password in the final summary. It was shown once during Step 4. The summary is a reference card the user might screenshot or scroll back to, so it should not contain the password.
381
+ Rules:
207
382
 
208
- After the summary, provide a brief "what's next" orientation:
383
+ - never include the password in the final summary
384
+ - include the hosted share URL only if it exists and the user explicitly asked for it after publish
385
+ - if publish is still finalizing, say so plainly instead of pretending it is live
209
386
 
210
- "Your portal is live locally. Here's what you can do next:
387
+ After the final summary, delete the checkpoint:
211
388
 
212
- - `/portal deploy` -- push to production so your client can access it
213
- - `/portal share <slug>` -- generate a share link (no login needed)
214
- - `/portal update <slug>` -- edit the portal content
215
- - `/portal analytics <slug>` -- track client engagement
216
- - `/portal status` -- see a dashboard of all your portals"
389
+ ```bash
390
+ rm -f "$HOME/.showpane/checkpoints/portal-onboard.json"
391
+ ```
217
392
 
218
393
  ## Flow Control
219
394
 
220
- This skill is a sequential orchestrator. Each step depends on the previous one:
221
-
222
- ```
223
- setup -> create -> credentials -> preview -> summary
224
- ```
395
+ This wizard is sequential, but it is state-aware.
225
396
 
226
397
  Rules:
227
- - **Never skip a step.** Even if the user says "I already have credentials", verify by checking the database. If credentials exist, acknowledge and move on. But do not skip the check.
228
- - **Stop on hard failures.** If setup cannot connect to the database, or create fails due to a missing dependency, stop and explain. Do not try to continue with a broken foundation.
229
- - **Retry on soft failures.** If the user picks a slug that is taken, help them pick another. If the dev server takes a moment to start, wait. These are not reasons to abort.
230
- - **Respect existing state.** If the user already has a configured Showpane, an existing portal, and credentials, acknowledge each one and skip to the next incomplete step. The onboard flow should work for both brand-new and partially-set-up installations.
231
398
 
232
- ## Detecting Existing State
399
+ - verify existing state before redoing work
400
+ - allow resume from any saved phase
401
+ - retry soft failures like slug conflicts or slow dev-server startup
402
+ - stop on hard failures like missing app path, broken schema setup, or cloud deploy errors that require user action
403
+ - keep the user in one coherent workflow instead of telling them to manually switch commands unless recovery requires it
233
404
 
234
- Before each step, check whether it has already been completed:
405
+ ## Existing State Checks
235
406
 
236
- 1. **Setup**: Check if `~/.showpane/config.json` exists and is valid. If yes, skip setup.
237
- 2. **Create**: Check if the org has at least one portal (via `list-portals.ts`). If yes, ask: "You already have portals. Want to create another, or skip to credentials?"
238
- 3. **Credentials**: Check if the selected portal has credentials (from list response `hasCredentials` field). If yes, skip credentials.
239
- 4. **Preview**: Always run. Opening the browser is always useful.
240
-
241
- ## Conventions
407
+ Check these before deciding to skip or rerun a phase:
242
408
 
243
- - Use encouraging but not patronizing language. "Great!" and "Let's move on" are fine. "Wow, amazing job!" is too much.
244
- - Keep transitions between steps to one sentence. Do not recap what just happened -- the user can see it.
245
- - Use double-line box drawing (`═`) for the final summary box only. Keep step transitions as plain text.
246
- - If the total onboard time exceeds 10 minutes (e.g., due to long create flow with Granola), do not comment on it. The user is working, not racing.
247
- - If learnings exist from a previous session, load them silently. The onboard flow benefits from prior context without mentioning it.
409
+ 1. setup/config present
410
+ 2. local org exists
411
+ 3. portal already exists for the selected slug
412
+ 4. credentials already exist
413
+ 5. local dev server is running
414
+ 6. cloud access token exists
248
415
 
249
- ## Error Handling
416
+ If a portal already exists and clearly looks like the same first-run draft, ask whether
417
+ to continue refining it or create a new portal. Recommend continuing unless the user says otherwise.
250
418
 
251
- - If the preamble itself fails (no config), this is expected for first-run. In this specific case, do NOT abort. Instead, proceed directly to the setup step: "Looks like Showpane isn't configured yet. Let's fix that."
252
- - If any bin/ script returns a non-zero exit, read the error from stderr, display it, and suggest a fix.
253
- - If the user wants to bail out mid-flow, respect it: "No problem. You can pick up where you left off by running the individual skills: /portal setup, /portal create, /portal credentials, /portal preview."
419
+ ## Conventions
254
420
 
255
- ## Special Case: Preamble Failure
421
+ - The wizard owns the first-run story. Do not redirect first-time users to freeform prompting unless they explicitly want it.
422
+ - Keep transitions to one sentence whenever possible.
423
+ - Prefer `recommended` over `optional` language when there is a clear best path.
424
+ - Use the cloud dashboard as a supporting surface for billing/provisioning, not as the main first-portal creation surface.
425
+ - If you mention manual prompting at all, position it as the faster repeat-user path.
256
426
 
257
- Unlike other skills, `/portal onboard` should NOT hard-fail if the preamble reports "Showpane not configured." The entire point of this skill is to handle first-run. If the config file does not exist, catch the preamble error and proceed to Step 2 (setup) which will create the config.
427
+ ## Error Handling
258
428
 
259
- To handle this: Run the preamble, capture the output. If it includes "not configured", note that setup is needed and continue. Do not exit.
429
+ - Missing config is not a preamble failure here. It simply means setup starts from scratch.
430
+ - If a step fails after useful progress, keep the checkpoint and tell the user exactly how to resume.
431
+ - If the user wants to stop early, summarize the current state and point them to the next concrete skill:
432
+ - `/portal-preview`
433
+ - `/portal-credentials`
434
+ - `/portal-share`
435
+ - `/portal-deploy`
260
436
 
261
437
  ## Completion
262
438
 
263
- As a final step, log skill completion:
439
+ As a final step, log skill completion and telemetry:
264
440
 
265
441
  ```bash
266
442
  echo '{"skill":"portal-onboard","event":"completed","ts":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"}' >> "$HOME/.showpane/timeline.jsonl" 2>/dev/null
443
+ _TEL_END=$(date +%s)
444
+ _TEL_DUR=$(( _TEL_END - ${_TEL_START:-_TEL_END} ))
445
+ "$HOME/.showpane/bin/showpane-telemetry-log" --skill "portal-onboard" --duration "$_TEL_DUR" --outcome success --session-id "${_SESSION_ID:-}" 2>/dev/null || true
267
446
  ```
268
-
269
- ## Related Skills
270
-
271
- This skill chains the following skills inline (read their SKILL.md files for detailed instructions):
272
- - `/portal setup` -- Step 2
273
- - `/portal create` -- Step 3
274
- - `/portal credentials` -- Step 4
275
- - `/portal preview` -- Step 5
276
- - `/portal dev` -- called within Step 5 if needed
277
- - `/portal deploy` -- suggested as next step in the summary