@joplo-app/core 0.2.8 → 0.2.9

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.
@@ -7,7 +7,7 @@
7
7
  * 原则:薄技能——只放心智模型、起步顺序和最常见的坑,具体 API 指向 `npx joplo skill <主题>`(与项目安装的版本一致)。
8
8
  */
9
9
  /** 心智模型:所有入口最先读到的几句话。 */
10
- export declare const MENTAL_MODEL: readonly ["Joplo is a player for pre-declared scenarios, not a free-form app prototype.", "Inputs show the sample value typed by the current step (read-only); viewers cannot type their own.", "Clicking the highlighted element plays the next declared step; other clicks only show a hint.", "Results and errors come from scenario effects (set, toast, done), not from real logic or a backend.", "Options (A/B) and cases (edge cases) are compared in the local board; only the picked option is published."];
10
+ export declare const MENTAL_MODEL: readonly ["Joplo is a player for pre-declared scenarios, not a free-form app prototype.", "Its job is to show a product feature working through visuals and motion: the real interface operated step by step, state changing on screen, calls traced through diagrams. It is not a slide or PPT tool.", "Inputs show the sample value typed by the current step (read-only); viewers cannot type their own.", "Clicking the highlighted element plays the next declared step; other clicks only show a hint.", "Results and errors come from scenario effects (set, toast, done), not from real logic or a backend.", "Options (A/B) and cases (edge cases) are compared in the local board; only the picked option is published."];
11
11
  /** 推荐的起步顺序(X2:先做最小的一条正常流程 + 一条错误恢复流程,在看板里确认交互模型后再扩展)。 */
12
12
  export declare const START_ORDER: readonly ["Read npx joplo skill authoring; read cases before asking the user about edge cases; demo and components as needed.", "Plan before coding (npx joplo skill story): audience, one to three points, one line per scenario (Given → When → Then, how it opens and ends; a case's expected is its Then); show the plan to the user. A demo is a story, not a feature tour.", "With minimal code, write one happy path and one error-and-recovery scenario.", "Run npx joplo check, then npx joplo dev; confirm typing, clicks, and layers really behave as intended in the board.", "Extend to every option and every case agreed with the user; run check until 0 errors.", "Give the user the board URL and a short list of what to check, then wait for their feedback."];
13
13
  /** 最常见的坑:一句话 + 详细主题。 */
@@ -9,6 +9,7 @@
9
9
  /** 心智模型:所有入口最先读到的几句话。 */
10
10
  export const MENTAL_MODEL = [
11
11
  'Joplo is a player for pre-declared scenarios, not a free-form app prototype.',
12
+ 'Its job is to show a product feature working through visuals and motion: the real interface operated step by step, state changing on screen, calls traced through diagrams. It is not a slide or PPT tool.',
12
13
  'Inputs show the sample value typed by the current step (read-only); viewers cannot type their own.',
13
14
  'Clicking the highlighted element plays the next declared step; other clicks only show a hint.',
14
15
  'Results and errors come from scenario effects (set, toast, done), not from real logic or a backend.',
@@ -37,7 +38,7 @@ export const PITFALLS = [
37
38
  /** 中文触发词:技能 description 里的匹配文本,不是 CLI 界面文案(english-output 测试的白名单)。 */
38
39
  const ZH_JOPLO = '功能原型、可交互演示、方案对比、给产品 / 设计 / 评审看的演示';
39
40
  const ZH_FEEDBACK = '评审有结论了、按评审意见修改演示';
40
- const JOPLO_DESCRIPTION = `Build clickable, replayable feature demos with Joplo (scripted scenarios in TSX, viewed in a local board) when the user wants a feature prototype, an interactive or clickable demo, an A/B comparison of options or edge cases, or a demo for product, design, or review (${ZH_JOPLO}), including in a repo without joplo.config.ts.`;
41
+ const JOPLO_DESCRIPTION = `Build clickable, replayable feature demos with Joplo (scripted scenarios in TSX, viewed in a local board) when the user wants a feature prototype, an interactive or clickable demo, an A/B comparison of options or edge cases, or a demo for product, design, or review (${ZH_JOPLO}), including in a repo without joplo.config.ts, but not for slide decks or PPT.`;
41
42
  const FEEDBACK_DESCRIPTION = `Apply Joplo review results when reviewers have commented on or decided about a Joplo review link and the user says the review has conclusions or asks to update the demo as reviewed (${ZH_FEEDBACK}); pulls decisions with npx joplo feedback and writes them back into the source.`;
42
43
  const list = (items) => items.map((s, i) => `${i + 1}. ${s}`);
43
44
  function joploBody() {
@@ -46,9 +47,18 @@ function joploBody() {
46
47
  '',
47
48
  ...MENTAL_MODEL,
48
49
  '',
50
+ '## Show the product, not slides',
51
+ 'Every step is an action on the product and a visible change it causes. If a step could be a bullet on a slide, rebuild it as interface, state, or a trace.',
52
+ '- Feature: not a card listing "enter email / teammate gets a link / joins today"; instead Ana types the email, clicks Send, the row appears as Pending, then Leo\'s layer opens the mail and lands in the space.',
53
+ '- Backend or architecture: not a card "App → API → Queue → Worker"; instead a Diagram where trace() lights each hop as the request moves and trace.fail() shows where it breaks, beside the UI whose status changes with it.',
54
+ '- Comparison: not a pros-and-cons table; instead options A and B each playing the same scenario, compared in the board.',
55
+ '- State or lifecycle: not a paragraph explaining statuses; instead a StateMachine whose current state moves as the user acts.',
56
+ '- Cards only open, close, jump in time, or switch roles; text that explains belongs in captions and explain(). Worked example: npx joplo skill story.',
57
+ '',
49
58
  '## When to use',
50
59
  '- The user wants to think a feature through before building it: a prototype, clickable demo, A/B options, edge cases, or a walkthrough for product, design, or review.',
51
60
  '- Not for production UI code, real backends, or demos where viewers type free input.',
61
+ '- Not for slide decks, pitch decks, or text-and-bullet presentations: with no product behavior to show, use a slides tool instead.',
52
62
  '',
53
63
  '## Workflow',
54
64
  '1. No joplo.config.ts yet: npx joplo@latest init <dir>, or npx joplo@latest init . for the current directory, then npm install there (versions are pinned). Agent and Git files (.git, .gitignore, .agents, .claude, AGENTS.md, skills-lock.json) do not count as content; other existing files need init . --keep, which only adds missing files. init skips these skills when the same version is already installed and never overwrites edited ones. In an existing Joplo project, use its installed npx joplo.',
@@ -105,7 +115,7 @@ export function agentsBlock() {
105
115
  return [
106
116
  '## Joplo',
107
117
  'This project designs features as Joplo demos (joplo.config.ts). Read npx joplo skill first, then the relevant topics: authoring for pages/options/scenarios, story for planning a demo and writing captions, components, cases before asking about edge cases, demo for layers, shots, traces, and captions, focus for where viewers look in each step, diagram for architecture, sequence, and state diagrams.',
108
- `Mental model: ${MENTAL_MODEL.slice(0, 4).join(' ')}`,
118
+ `Mental model: ${MENTAL_MODEL.slice(0, 5).join(' ')}`,
109
119
  `Start: ${START_ORDER.map((s, i) => `(${i + 1}) ${s}`).join(' ')}`,
110
120
  'Pitfalls:',
111
121
  ...PITFALLS.slice(0, 6).map(([text, topic]) => `- ${text} (npx joplo skill ${topic}).`),
package/dist/guide.js CHANGED
@@ -136,14 +136,39 @@ const CONTENT = {
136
136
  A demo is a short story a viewer follows without you: who wants what, what gets in the way, what the product does, and the visible result.
137
137
  It is not a feature tour. Plan it in a few lines before writing TSX, show the plan to the user, then build. Sources: docs/research/storytelling-and-demos.md.
138
138
 
139
- ## 1. Plan the demo first (write it in your reply; ask only questions that change it, each with a default)
139
+ ## 1. Show the product working, not slides
140
+ Joplo exists to demonstrate product behavior with visuals and motion. It is not a PPT tool: a demo made of text cards and bullet lists has failed, however good the text.
141
+ - Every step = a cause the viewer sees (a click, typing, an incoming message, a system event) + a change it makes (a new row, a status, a toast, a trace, a layer switch).
142
+ - Show, do not tell: a claim like 'invites are fast' becomes the invite happening on screen; 'the queue absorbs spikes' becomes trace() through the queue while the UI stays responsive.
143
+ - Text has a supporting role: captions narrate what is on screen, explain() says why it matters, cards only open, close, jump in time, or switch roles.
144
+ - Pick the visual by what you prove: UI flow → the product screens; who calls whom → Diagram + trace(); time order → Sequence; lifecycle → StateMachine; two answers → options A/B on the same scenario.
145
+ Slide version (wrong): the same points as cards, nothing to operate, nothing changes.
146
+ \`\`\`tsx
147
+ flow('Invite by email', { start: '/members' })
148
+ .card('Invite by email', { points: ['Enter an email', 'Teammate gets a link', 'Joins the same day'] })
149
+ .card('Why it matters', { points: ['Faster onboarding', 'Fewer support tickets'] })
150
+ \`\`\`
151
+ Product version (right): the same points, proven by the interface.
152
+ \`\`\`tsx
153
+ flow('Invite a teammate', { start: '/members' })
154
+ .card('Ana needs Leo in the space today', { sub: 'She is the space admin' })
155
+ .click('btn_invite', 'Ana opens Invite', set($.ui.inviteOpen, true))
156
+ .type('in_email', 'leo@acme.com', 'Ana enters Leo\'s email')
157
+ .click('btn_send', 'The invite is on its way', set($.ui.inviteOpen, false),
158
+ push($.data.pending, { email: 'leo@acme.com', status: 'Pending' }), toast.success('Invite sent to leo@acme.com'))
159
+ .card('Now Leo', { role: 'leo' })
160
+ .click('mail_join', 'Leo opens the link and lands in the space', go('/space'), done('Leo joins the same day'))
161
+ \`\`\`
162
+ Backend behind the same feature: put a Diagram in its own layer and .system('Send mail', 'The mail job runs in the background', trace('api', 'queue', 'mailer'), shot('mailer')); a failure is trace.fail('queue', 'mailer') plus the error the user sees. Full examples: examples/invite, examples/agent-arch.
163
+
164
+ ## 2. Plan the demo first (write it in your reply; ask only questions that change it, each with a default)
140
165
  - Audience: who watches (product review, design review, a customer, engineers) and what they must decide afterward.
141
166
  - One to three points: what viewers must believe after watching. Each point becomes a scenario or an A/B comparison, never a single step.
142
167
  - Scene list, one line per scenario: Given (who, where, starting state) → When (the user's actions) → Then (the visible result), plus how it opens and how it ends.
143
168
  - Length: a scenario is usually 5–12 steps, about 20–60 s at 1×. check flags one over 90 s; npx joplo outline prints every estimate.
144
169
  - Unsure how to frame it? Offer two or three one-line framings and let the user pick.
145
170
 
146
- ## 2. PM lens: from a need to roles, goal, cases, and scenarios
171
+ ## 3. PM lens: from a need to roles, goal, cases, and scenarios
147
172
  Joplo already has the parts of a user story; fill them in that spirit.
148
173
  - roles: who it is for, specific ('Space admin', 'Invited teammate'), not 'User'. Use role('Name', { desc }) keys when layers or cards belong to a person; plain names are fine otherwise.
149
174
  - goal (the I want + so that): one sentence, who can do what and why, independent of the solution so options A/B are two answers to it.
@@ -158,7 +183,7 @@ Joplo already has the parts of a user story; fill them in that spirit.
158
183
  - INVEST check per scenario: Independent (its own start state), Valuable (ends on a visible result), Small (fits the length above), Testable (expected says exactly what appears).
159
184
  - Direction still open? Build only the main scenario of options A and B first; add every case after the user picks.
160
185
 
161
- ## 3. Openings, middles, endings
186
+ ## 4. Openings, middles, endings
162
187
  - Opening: the first step or an opening .card('…', { sub }) says who is trying to do what and why, in one sentence. No logo, no 'So you open the app'.
163
188
  - Middle: each step proves one thing with a visible action and a visible change; the cause must be visible (a click, an incoming message, a time-jump card).
164
189
  A screen that changes with no trigger reads as a screensaver. Mock results come from steps: set(), toast(), go().
@@ -166,7 +191,7 @@ Joplo already has the parts of a user story; fill them in that spirit.
166
191
  - Transitions: keep something on screen across a change (the same list, the same person); cards only for time jumps, role switches, opening, and ending.
167
192
  - Where the viewer looks each moment (one focus per step, spotlight, highlight, callout, numbered, hold): npx joplo skill focus; layers and shots: npx joplo skill demo.
168
193
 
169
- ## 4. Captions and explain
194
+ ## 5. Captions and explain
170
195
  - One idea per caption, about 24 units (CJK 1, other characters 0.5). Subject + verb, active voice, the visible action first: 'Ana sends the invite', 'The link expires after 7 days'.
171
196
  - explain (about 48 units) says why it matters or what it means; never repeat the caption.
172
197
  - System steps are narration of what happened ('The server rejects the address'), not labels ('System event').
@@ -175,10 +200,11 @@ Joplo already has the parts of a user story; fill them in that spirit.
175
200
  - Cover text: flow({ description }) is the cover sentence, 30 units at most (DESCRIPTION_TOO_LONG). The cover falls back to the feature goal.
176
201
  - Rhythm: every short step waits 3 s, so a run of trivial steps feels like a metronome. Merge trivial steps (type, then click) and give key results an explain.
177
202
 
178
- ## 5. Before handing over
203
+ ## 6. Before handing over
179
204
  - npx joplo outline: per feature, who it is for, the goal, each case with its expected result and coverage per option, and each scenario's steps, duration, opening and ending.
180
205
  - npx joplo check: CAPTION_TOO_LONG, EXPLAIN_TOO_LONG, DESCRIPTION_TOO_LONG, CARD_TEXT_TOO_LONG, SCENARIO_TOO_LONG, HAPPY_PATH_ONLY, CASE_NOT_COVERED (names the expected result).
181
206
  - Read only the captions from start to end: do they tell the story? Then look only at key frames (npx joplo render --step-id …): does the screen show it without captions?
207
+ - If the key frames look like slide thumbnails (mostly cards, bullet points, or a screen that never changes), rebuild those steps as actions and visible changes (section 1).
182
208
  - Tell the user which cases have no expected result yet and which options do not cover a high-priority case.`,
183
209
  authoring: `# Joplo authoring: authoring
184
210
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joplo-app/core",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Joplo 编译器、校验器与播放器(IR v2)",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  "dist"
20
20
  ],
21
21
  "dependencies": {
22
- "@joplo-app/kit": "0.2.8",
22
+ "@joplo-app/kit": "0.2.9",
23
23
  "elkjs": "0.12.1",
24
24
  "zod": "4.6.7"
25
25
  },