@joplo-app/core 0.5.0 → 0.6.0
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.
- package/dist/agent-skill.d.ts +7 -7
- package/dist/agent-skill.js +28 -25
- package/dist/authoring-works.d.ts +8 -0
- package/dist/authoring-works.js +46 -0
- package/dist/catalog.d.ts +2 -0
- package/dist/compile.d.ts +6 -3
- package/dist/compile.js +415 -340
- package/dist/content-i18n.js +9 -9
- package/dist/embed.d.ts +5 -5
- package/dist/embed.js +7 -7
- package/dist/entries.d.ts +63 -0
- package/dist/entries.js +78 -0
- package/dist/feature-diff.d.ts +7 -7
- package/dist/feature-diff.js +18 -17
- package/dist/features.d.ts +3 -3
- package/dist/features.js +3 -3
- package/dist/focus-check.js +2 -2
- package/dist/focus.d.ts +1 -5
- package/dist/focus.js +13 -35
- package/dist/guide.js +156 -66
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/load.js +42 -11
- package/dist/local-review-files.js +17 -4
- package/dist/local-review.d.ts +8 -7
- package/dist/local-review.js +7 -6
- package/dist/outline.d.ts +21 -13
- package/dist/outline.js +27 -32
- package/dist/pace.d.ts +3 -4
- package/dist/pace.js +3 -4
- package/dist/playback.d.ts +57 -0
- package/dist/playback.js +317 -0
- package/dist/player.d.ts +9 -195
- package/dist/player.js +8 -633
- package/dist/playground.d.ts +1 -1
- package/dist/playground.js +4 -4
- package/dist/plugins/compiler.d.ts +16 -0
- package/dist/plugins/compiler.js +48 -9
- package/dist/presentation.d.ts +73 -0
- package/dist/presentation.js +163 -0
- package/dist/publication.d.ts +8 -0
- package/dist/publication.js +45 -0
- package/dist/result.d.ts +1 -1
- package/dist/review.d.ts +18 -10
- package/dist/review.js +62 -23
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +2 -0
- package/dist/scene-query.d.ts +77 -0
- package/dist/scene-query.js +246 -0
- package/dist/schema-issues.js +1 -1
- package/dist/schema.d.ts +108 -76
- package/dist/schema.js +48 -36
- package/dist/scope.d.ts +9 -9
- package/dist/scope.js +82 -49
- package/dist/selection.d.ts +1 -1
- package/dist/sequencing.d.ts +6 -0
- package/dist/sequencing.js +21 -0
- package/dist/step-plan.d.ts +55 -0
- package/dist/step-plan.js +90 -0
- package/dist/traits.d.ts +10 -0
- package/dist/traits.js +3 -0
- package/dist/validate.d.ts +1 -1
- package/dist/validate.js +75 -65
- package/dist/voice.js +2 -1
- package/package.json +15 -3
package/dist/agent-skill.d.ts
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
/** `npx joplo skill <主题>` 的主题与一句话用途(guide.ts 生成正文;技能里按这份清单列出主题)。 */
|
|
10
10
|
export declare const SKILL_TOPICS: readonly [{
|
|
11
11
|
readonly name: "authoring";
|
|
12
|
-
readonly description: "
|
|
12
|
+
readonly description: "Works → slices → steps; feature review, chapters, drafts, files, explicit plugins, named local reactions, composable effects, state and conditions";
|
|
13
13
|
}, {
|
|
14
14
|
readonly name: "story";
|
|
15
|
-
readonly description: "Plan a
|
|
15
|
+
readonly description: "Plan a show before coding; for feature review start from needs, roles, goals and cases; for explainers and histories plan openings, continuity and captions";
|
|
16
16
|
}, {
|
|
17
17
|
readonly name: "demo";
|
|
18
18
|
readonly description: "Scripted playback and local exploration, drag / hover / scroll / plugin actions, confirmed action entries, themes, layers, captions, deep links and screenshots";
|
|
@@ -21,7 +21,7 @@ export declare const SKILL_TOPICS: readonly [{
|
|
|
21
21
|
readonly description: "Guide attention: one focus per step, defaults, spotlight / highlight / callout / numbered / hold / redact";
|
|
22
22
|
}, {
|
|
23
23
|
readonly name: "cases";
|
|
24
|
-
readonly description: "
|
|
24
|
+
readonly description: "Feature-attached works only: cases and coverage; ask the user before starting";
|
|
25
25
|
}, {
|
|
26
26
|
readonly name: "check";
|
|
27
27
|
readonly description: "Read diagnostics, music duration/markers and timing warnings, UNBOUND_INTERACTIVE, and fix the indicated file and line";
|
|
@@ -36,17 +36,17 @@ export declare const SKILL_TOPICS: readonly [{
|
|
|
36
36
|
readonly description: "Compare public feature builds, stable step identity, uncertain matches, isolated PR CI publication";
|
|
37
37
|
}, {
|
|
38
38
|
readonly name: "publish";
|
|
39
|
-
readonly description: "pick, build, explicit public/private and review choices, portfolios and SEO, Pro passwords, review version, feedback write-back, deployment, chapters and phone viewing, viewers in several languages, narration (Joplo Cloud characters, keys, joplo voice)";
|
|
39
|
+
readonly description: "Standalone works, drafts, --work scope, feature pick, build, explicit public/private and review choices, portfolios and SEO, Pro passwords, review version, feedback write-back, deployment, chapters and phone viewing, viewers in several languages, narration (Joplo Cloud characters, keys, joplo voice)";
|
|
40
40
|
}, {
|
|
41
41
|
readonly name: "plugins";
|
|
42
42
|
readonly description: "Data-only action contracts, native local behavior, engine-clock presenters; Universal properties, plugin themes, state writes and director targets; Binary assets, explicit paid resource generation, persistent artifacts, media tracks and offline publishing; API v2 immutable hooks, scoped/localized snapshots, shared React and production-package checks";
|
|
43
43
|
}];
|
|
44
44
|
/** 心智模型:所有入口最先读到的几句话。 */
|
|
45
|
-
export declare const MENTAL_MODEL: readonly ["Joplo
|
|
45
|
+
export declare const MENTAL_MODEL: readonly ["Joplo shows are playable, interactive pieces your agent writes in code: compare feature options, explain how a system runs, or show what happened. Share them by link or embed their player. It is a player for pre-declared scenarios, not a free-form app prototype with persistent data or real backend logic, and not a slide or PPT tool: you write the screens and scripted scenarios in TSX, the local board plays them step by step, and reviewers compare options and leave feedback.", "Structure: a project is a portfolio of works; a work has slices (scenarios), and a slice has steps. Every work has a cover and enters the home page. Capabilities combine: feature review groups alternative works (options) with cases, coverage, rules and a pick; sequencing connects chapters; draft keeps a standalone work out of publication.", "A step is one user action (.click / .type / .select / .press / .drag / .hover / .scroll / .act) or system event plus its visible effects (set, toast, go, done). Results and errors come from these effects, not from real logic or a backend.", "During playback, the first picture-changing stage input pauses and applies that same input. Hover does not pause; blank clicks only pause without an exploration notice. Matching the next action advances the script and stays stopped; another reachable scenario asks to switch (default before the action; actionEntry: 'after' consumes it on confirmation); native controls and declared free reactions change only a local playground. Play, jump, scenario change and reset discard exploration. Screenshots, video and deep links always use scripted state.", "work() is the only work entry point. Use work() + chapter() in works/<key>.tsx for a standalone show; compare feature options with feature() + work() in features/<f>/works/<key>.tsx. The UI calls these alternative works options. Both can coexist. Standalone works need no pick; draft: true excludes them from build and share. Publish one entry with --work <key>; feature publication still uses pick."];
|
|
46
46
|
/** 推荐的起步顺序(X2:先做最小的一条正常流程 + 一条错误恢复流程,在看板里确认交互模型后再扩展)。 */
|
|
47
|
-
export declare const START_ORDER: readonly ["Read npx joplo skill authoring; read cases before asking the user about edge cases; demo and installed plugin skills 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.", "Required after every round of development: before handing off, read npx joplo skill review and start npx joplo feedback watch [dir] --local --follow --json in its own shell (joplo dev prints this exact command); only then give the user the board URL dev printed. Never hand off with only a URL, and never end your response without a running watcher (use --once below). While they test, read its output with short waits (about 1–5s) and acknowledge each feedback right away; do not wait for approval or process exit. If you end your response while they test, add --once so the watcher exits (and wakes a host that resumes on background exit) on the first event, then resume with --since. Receive and apply review results with the joplo-feedback skill."];
|
|
47
|
+
export declare const START_ORDER: readonly ["Choose the starting template: compare feature options with npx joplo init <dir> (or --template starter); make one show people can play, pause and try with npx joplo init <dir> --template work. Bare names select built-ins, never a same-named local directory; use --template ./work for a local folder. Both use the CLI version tag and install engine skills, AGENTS.md and enabled plugin guides.", "Read npx joplo skill authoring and choose the capabilities; for feature review read cases before asking the user about edge cases; demo and installed plugin skills 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 chapter for a standalone work, or one happy path and one error-and-recovery scenario for feature review.", "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 for feature review, or to the agreed chapters for a standalone work; run check until 0 errors.", "Required after every round of development: before handing off, read npx joplo skill review and start npx joplo feedback watch [dir] --local --follow --json in its own shell (joplo dev prints this exact command); only then give the user the board URL dev printed. Never hand off with only a URL, and never end your response without a running watcher (use --once below). While they test, read its output with short waits (about 1–5s) and acknowledge each feedback right away; do not wait for approval or process exit. If you end your response while they test, add --once so the watcher exits (and wakes a host that resumes on background exit) on the first event, then resume with --since. Receive and apply review results with the joplo-feedback skill."];
|
|
48
48
|
/** 最常见的坑:一句话 + 详细主题。 */
|
|
49
|
-
export declare const PITFALLS: readonly [readonly ["Finishing development is not the end: always start npx joplo feedback watch [dir] --local --follow --json (add --once if you will end your response) before you give the user the board URL, and keep receiving their feedback", "review"], readonly ["when takes a condition, not a boolean: when={eq($.ui.mode, 'code')}, never when={mode === 'code'}; for values known while writing use {flag && <X/>}", "authoring"], readonly ["Every interactive element needs a flow step, disabled={true} with disabledReason, or unmodeled; otherwise check warns UNBOUND_INTERACTIVE", "check"], readonly ["No onClick or other function props: behavior lives in flow steps (.click/.type/.select) and effects (set, push, go, done)", "authoring"], readonly ["Full-height layouts squeeze tables and forms: rows exist in the DOM but are cut off on screen; show 5–8 rows or move the table to its own layer", "demo"], readonly ["Deep links use short params ?o=&c=&s=&step=&l= (l is the layer key and pins that layer, so later steps stop switching layers; layer= is ignored); wait for rendering before screenshots", "demo"], readonly ["Rules you assume stay origin ai_assumption, status pending; never mark them confirmed for the user", "cases"], readonly ["CHOICE_REQUIRED (exit 2): ask both publishing questions; never fix it by silently adding --private --no-review, and do not reuse the previous invocation", "publish"], readonly ["Public portfolio work and the always-private review version are two separate links: give reviewers data.review.url, the audience data.url", "publish"], readonly ["Required: before every share, ask the user public or private AND whether to also publish a review version. Never choose for them or reuse a previous choice; CI must pin both flags in its workflow", "publish"], readonly ["Public shares enter the portfolio and search engines: write the project name, description, and feature goals as search-result content; exclude unpublished information", "publish"], readonly ["Never invent or set an access password for the user: ask them to type it in their own terminal or set JOPLO_SHARE_PASSWORD; never put passwords in command history, files, or conversation summaries. Private Pro shares accept --password; omit both password flags to preserve protection", "publish"], readonly ["Never share or deploy without the user's go-ahead. Free links no longer expire, but every live share counts toward the account storage; if share fails with QUOTA_EXCEEDED (exit 6), tell the user the numbers and the two links from error.details, never delete their shares yourself", "publish"], readonly ["Joplo Cloud narration spends the user's characters: run npx joplo voice --dry-run and tell them the estimate before a large batch; on TTS_QUOTA_EXCEEDED (exit 7) keep what was made, pass on error.details.usageUrl, and never retry in a loop or buy for them", "publish"], readonly ["AiHubMix, OpenAI-compatible gateways and custom HTTP voice providers are gone: VOICE_UNSUPPORTED means ask the user to switch to Joplo Cloud narration, OpenAI or ElevenLabs (old audio still plays and ships); never hand-edit ~/.joplo/voice/profiles.json", "publish"], readonly ["Playing a demo never generates Joplo Cloud narration (it would spend characters): steps without audio use the browser voice until the user clicks Generate missing audio or you run npx joplo voice with their go-ahead", "publish"], readonly ["Re-sharing with the default voice keeps valid local clips plus reusable published clips, even when their voices differ (automatic captions must still match current text in the clip language; stale audio is excluded); an old custom provider named cloud stays unsupported until the user explicitly chooses official Joplo Cloud (use voice.profile: 'Joplo Cloud' when config owns the selection)", "publish"], readonly ["HAPPY_PATH_ONLY
|
|
49
|
+
export declare const PITFALLS: readonly [readonly ["Finishing development is not the end: always start npx joplo feedback watch [dir] --local --follow --json (add --once if you will end your response) before you give the user the board URL, and keep receiving their feedback", "review"], readonly ["when takes a condition, not a boolean: when={eq($.ui.mode, 'code')}, never when={mode === 'code'}; for values known while writing use {flag && <X/>}", "authoring"], readonly ["Every interactive element needs a flow step, disabled={true} with disabledReason, or unmodeled; otherwise check warns UNBOUND_INTERACTIVE", "check"], readonly ["No onClick or other function props: behavior lives in flow steps (.click/.type/.select) and effects (set, push, go, done)", "authoring"], readonly ["Full-height layouts squeeze tables and forms: rows exist in the DOM but are cut off on screen; show 5–8 rows or move the table to its own layer", "demo"], readonly ["Deep links use short params ?o=&c=&s=&step=&l= (l is the layer key and pins that layer, so later steps stop switching layers; layer= is ignored); wait for rendering before screenshots", "demo"], readonly ["Rules you assume stay origin ai_assumption, status pending; never mark them confirmed for the user", "cases"], readonly ["CHOICE_REQUIRED (exit 2): ask both publishing questions; never fix it by silently adding --private --no-review, and do not reuse the previous invocation", "publish"], readonly ["Public portfolio work and the always-private review version are two separate links: give reviewers data.review.url, the audience data.url", "publish"], readonly ["Required: before every share, ask the user public or private AND whether to also publish a review version. Never choose for them or reuse a previous choice; CI must pin both flags in its workflow", "publish"], readonly ["Public shares enter the portfolio and search engines: write the project name, description, and feature goals and work summaries as search-result content; exclude unpublished information", "publish"], readonly ["Never invent or set an access password for the user: ask them to type it in their own terminal or set JOPLO_SHARE_PASSWORD; never put passwords in command history, files, or conversation summaries. Private Pro shares accept --password; omit both password flags to preserve protection", "publish"], readonly ["Never share or deploy without the user's go-ahead. Free links no longer expire, but every live share counts toward the account storage; if share fails with QUOTA_EXCEEDED (exit 6), tell the user the numbers and the two links from error.details, never delete their shares yourself", "publish"], readonly ["Joplo Cloud narration spends the user's characters: run npx joplo voice --dry-run and tell them the estimate before a large batch; on TTS_QUOTA_EXCEEDED (exit 7) keep what was made, pass on error.details.usageUrl, and never retry in a loop or buy for them", "publish"], readonly ["AiHubMix, OpenAI-compatible gateways and custom HTTP voice providers are gone: VOICE_UNSUPPORTED means ask the user to switch to Joplo Cloud narration, OpenAI or ElevenLabs (old audio still plays and ships); never hand-edit ~/.joplo/voice/profiles.json", "publish"], readonly ["Playing a demo never generates Joplo Cloud narration (it would spend characters): steps without audio use the browser voice until the user clicks Generate missing audio or you run npx joplo voice with their go-ahead", "publish"], readonly ["Re-sharing with the default voice keeps valid local clips plus reusable published clips, even when their voices differ (automatic captions must still match current text in the clip language; stale audio is excluded); an old custom provider named cloud stays unsupported until the user explicitly chooses official Joplo Cloud (use voice.profile: 'Joplo Cloud' when config owns the selection)", "publish"], readonly ["HAPPY_PATH_ONLY applies only to feature review: for a standalone explainer use work() + chapter(), with no cases or uses(); do not invent failure scenarios", "check"], readonly ["Required for short films and explainers: static storyboards cannot show hard cuts or frozen pictures. Run npx joplo render <dir> --scenario-id <first chapter> --film --chain, fix every CUT and STILL it reports, and watch --video once before handing over", "demo"], readonly ["For multimodal stories, list assets and licenses first, prove one real asset in a playable chapter, then extend the batch within the agreed spending limit. Keep source claims separate from interpretations", "story"], readonly ["For generated binary assets, first look for CC0/public-domain material; use an enabled generation plugin for gaps. Run resources --dry-run before spending; check/build/render never generate paid artifacts. Commit outputs and metadata, keep keys local", "plugins"], readonly ["For background audio use a media plugin: enable it explicitly, read its skill, place play/stop in steps, and verify sound after a viewer gesture; local resource failures are warnings", "plugins"], readonly ["Collect reusable assets before drawing complex visuals; keep source URLs, authors, licenses and changes in assets/SOURCES.md, and verify bundled fonts and samples separately", "story"], readonly ["For audience exploration, use native UI controls or work.free; keep deterministic results in flow steps. Read demo before using drag, hover, scroll or plugin actions", "demo"], readonly ["Components outside the catalog may exist as plugins: install the npm package, add it to config({ plugins }), then read npx joplo skill <plugin id> before writing its components", "plugins"]];
|
|
50
50
|
export type AgentSkill = {
|
|
51
51
|
name: string;
|
|
52
52
|
description: string;
|
package/dist/agent-skill.js
CHANGED
|
@@ -8,33 +8,34 @@
|
|
|
8
8
|
*/
|
|
9
9
|
/** `npx joplo skill <主题>` 的主题与一句话用途(guide.ts 生成正文;技能里按这份清单列出主题)。 */
|
|
10
10
|
export const SKILL_TOPICS = [
|
|
11
|
-
{ name: 'authoring', description: '
|
|
12
|
-
{ name: 'story', description: 'Plan a
|
|
11
|
+
{ name: 'authoring', description: 'Works → slices → steps; feature review, chapters, drafts, files, explicit plugins, named local reactions, composable effects, state and conditions' },
|
|
12
|
+
{ name: 'story', description: 'Plan a show before coding; for feature review start from needs, roles, goals and cases; for explainers and histories plan openings, continuity and captions' },
|
|
13
13
|
{ name: 'demo', description: 'Scripted playback and local exploration, drag / hover / scroll / plugin actions, confirmed action entries, themes, layers, captions, deep links and screenshots' },
|
|
14
14
|
{ name: 'focus', description: 'Guide attention: one focus per step, defaults, spotlight / highlight / callout / numbered / hold / redact' },
|
|
15
|
-
{ name: 'cases', description: '
|
|
15
|
+
{ name: 'cases', description: 'Feature-attached works only: cases and coverage; ask the user before starting' },
|
|
16
16
|
{ name: 'check', description: 'Read diagnostics, music duration/markers and timing warnings, UNBOUND_INTERACTIVE, and fix the indicated file and line' },
|
|
17
17
|
{ name: 'selection', description: 'Edit only the element selected by the user in the board' },
|
|
18
18
|
{ name: 'review', description: 'Local live feedback, Share polling, prompt acknowledgement, session/version isolation, and recovery' },
|
|
19
19
|
{ name: 'diff', description: 'Compare public feature builds, stable step identity, uncertain matches, isolated PR CI publication' },
|
|
20
|
-
{ name: 'publish', description: 'pick, build, explicit public/private and review choices, portfolios and SEO, Pro passwords, review version, feedback write-back, deployment, chapters and phone viewing, viewers in several languages, narration (Joplo Cloud characters, keys, joplo voice)' },
|
|
20
|
+
{ name: 'publish', description: 'Standalone works, drafts, --work scope, feature pick, build, explicit public/private and review choices, portfolios and SEO, Pro passwords, review version, feedback write-back, deployment, chapters and phone viewing, viewers in several languages, narration (Joplo Cloud characters, keys, joplo voice)' },
|
|
21
21
|
{ name: 'plugins', description: 'Data-only action contracts, native local behavior, engine-clock presenters; Universal properties, plugin themes, state writes and director targets; Binary assets, explicit paid resource generation, persistent artifacts, media tracks and offline publishing; API v2 immutable hooks, scoped/localized snapshots, shared React and production-package checks' },
|
|
22
22
|
];
|
|
23
23
|
/** 心智模型:所有入口最先读到的几句话。 */
|
|
24
24
|
export const MENTAL_MODEL = [
|
|
25
|
-
'Joplo
|
|
26
|
-
'Structure: a project
|
|
25
|
+
'Joplo shows are playable, interactive pieces your agent writes in code: compare feature options, explain how a system runs, or show what happened. Share them by link or embed their player. It is a player for pre-declared scenarios, not a free-form app prototype with persistent data or real backend logic, and not a slide or PPT tool: you write the screens and scripted scenarios in TSX, the local board plays them step by step, and reviewers compare options and leave feedback.',
|
|
26
|
+
'Structure: a project is a portfolio of works; a work has slices (scenarios), and a slice has steps. Every work has a cover and enters the home page. Capabilities combine: feature review groups alternative works (options) with cases, coverage, rules and a pick; sequencing connects chapters; draft keeps a standalone work out of publication.',
|
|
27
27
|
'A step is one user action (.click / .type / .select / .press / .drag / .hover / .scroll / .act) or system event plus its visible effects (set, toast, go, done). Results and errors come from these effects, not from real logic or a backend.',
|
|
28
28
|
'During playback, the first picture-changing stage input pauses and applies that same input. Hover does not pause; blank clicks only pause without an exploration notice. Matching the next action advances the script and stays stopped; another reachable scenario asks to switch (default before the action; actionEntry: \'after\' consumes it on confirmation); native controls and declared free reactions change only a local playground. Play, jump, scenario change and reset discard exploration. Screenshots, video and deep links always use scripted state.',
|
|
29
|
-
'
|
|
29
|
+
'work() is the only work entry point. Use work() + chapter() in works/<key>.tsx for a standalone show; compare feature options with feature() + work() in features/<f>/works/<key>.tsx. The UI calls these alternative works options. Both can coexist. Standalone works need no pick; draft: true excludes them from build and share. Publish one entry with --work <key>; feature publication still uses pick.',
|
|
30
30
|
];
|
|
31
31
|
/** 推荐的起步顺序(X2:先做最小的一条正常流程 + 一条错误恢复流程,在看板里确认交互模型后再扩展)。 */
|
|
32
32
|
export const START_ORDER = [
|
|
33
|
-
'
|
|
33
|
+
'Choose the starting template: compare feature options with npx joplo init <dir> (or --template starter); make one show people can play, pause and try with npx joplo init <dir> --template work. Bare names select built-ins, never a same-named local directory; use --template ./work for a local folder. Both use the CLI version tag and install engine skills, AGENTS.md and enabled plugin guides.',
|
|
34
|
+
'Read npx joplo skill authoring and choose the capabilities; for feature review read cases before asking the user about edge cases; demo and installed plugin skills as needed.',
|
|
34
35
|
'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.',
|
|
35
|
-
'With minimal code, write one happy path and one error-and-recovery scenario.',
|
|
36
|
+
'With minimal code, write one chapter for a standalone work, or one happy path and one error-and-recovery scenario for feature review.',
|
|
36
37
|
'Run npx joplo check, then npx joplo dev; confirm typing, clicks, and layers really behave as intended in the board.',
|
|
37
|
-
'Extend to every option and every case agreed with the user; run check until 0 errors.',
|
|
38
|
+
'Extend to every option and every case agreed with the user for feature review, or to the agreed chapters for a standalone work; run check until 0 errors.',
|
|
38
39
|
'Required after every round of development: before handing off, read npx joplo skill review and start npx joplo feedback watch [dir] --local --follow --json in its own shell (joplo dev prints this exact command); only then give the user the board URL dev printed. Never hand off with only a URL, and never end your response without a running watcher (use --once below). While they test, read its output with short waits (about 1–5s) and acknowledge each feedback right away; do not wait for approval or process exit. If you end your response while they test, add --once so the watcher exits (and wakes a host that resumes on background exit) on the first event, then resume with --since. Receive and apply review results with the joplo-feedback skill.',
|
|
39
40
|
];
|
|
40
41
|
/** 最常见的坑:一句话 + 详细主题。 */
|
|
@@ -49,26 +50,26 @@ export const PITFALLS = [
|
|
|
49
50
|
["CHOICE_REQUIRED (exit 2): ask both publishing questions; never fix it by silently adding --private --no-review, and do not reuse the previous invocation", "publish"],
|
|
50
51
|
["Public portfolio work and the always-private review version are two separate links: give reviewers data.review.url, the audience data.url", "publish"],
|
|
51
52
|
["Required: before every share, ask the user public or private AND whether to also publish a review version. Never choose for them or reuse a previous choice; CI must pin both flags in its workflow", "publish"],
|
|
52
|
-
["Public shares enter the portfolio and search engines: write the project name, description, and feature goals as search-result content; exclude unpublished information", "publish"],
|
|
53
|
+
["Public shares enter the portfolio and search engines: write the project name, description, and feature goals and work summaries as search-result content; exclude unpublished information", "publish"],
|
|
53
54
|
["Never invent or set an access password for the user: ask them to type it in their own terminal or set JOPLO_SHARE_PASSWORD; never put passwords in command history, files, or conversation summaries. Private Pro shares accept --password; omit both password flags to preserve protection", "publish"],
|
|
54
55
|
["Never share or deploy without the user's go-ahead. Free links no longer expire, but every live share counts toward the account storage; if share fails with QUOTA_EXCEEDED (exit 6), tell the user the numbers and the two links from error.details, never delete their shares yourself", "publish"],
|
|
55
56
|
["Joplo Cloud narration spends the user's characters: run npx joplo voice --dry-run and tell them the estimate before a large batch; on TTS_QUOTA_EXCEEDED (exit 7) keep what was made, pass on error.details.usageUrl, and never retry in a loop or buy for them", "publish"],
|
|
56
57
|
["AiHubMix, OpenAI-compatible gateways and custom HTTP voice providers are gone: VOICE_UNSUPPORTED means ask the user to switch to Joplo Cloud narration, OpenAI or ElevenLabs (old audio still plays and ships); never hand-edit ~/.joplo/voice/profiles.json", "publish"],
|
|
57
58
|
["Playing a demo never generates Joplo Cloud narration (it would spend characters): steps without audio use the browser voice until the user clicks Generate missing audio or you run npx joplo voice with their go-ahead", "publish"],
|
|
58
59
|
["Re-sharing with the default voice keeps valid local clips plus reusable published clips, even when their voices differ (automatic captions must still match current text in the clip language; stale audio is excluded); an old custom provider named cloud stays unsupported until the user explicitly chooses official Joplo Cloud (use voice.profile: 'Joplo Cloud' when config owns the selection)", "publish"],
|
|
59
|
-
["HAPPY_PATH_ONLY
|
|
60
|
+
["HAPPY_PATH_ONLY applies only to feature review: for a standalone explainer use work() + chapter(), with no cases or uses(); do not invent failure scenarios", "check"],
|
|
60
61
|
["Required for short films and explainers: static storyboards cannot show hard cuts or frozen pictures. Run npx joplo render <dir> --scenario-id <first chapter> --film --chain, fix every CUT and STILL it reports, and watch --video once before handing over", "demo"],
|
|
61
62
|
["For multimodal stories, list assets and licenses first, prove one real asset in a playable chapter, then extend the batch within the agreed spending limit. Keep source claims separate from interpretations", "story"],
|
|
62
63
|
["For generated binary assets, first look for CC0/public-domain material; use an enabled generation plugin for gaps. Run resources --dry-run before spending; check/build/render never generate paid artifacts. Commit outputs and metadata, keep keys local", "plugins"],
|
|
63
64
|
["For background audio use a media plugin: enable it explicitly, read its skill, place play/stop in steps, and verify sound after a viewer gesture; local resource failures are warnings", "plugins"],
|
|
64
65
|
["Collect reusable assets before drawing complex visuals; keep source URLs, authors, licenses and changes in assets/SOURCES.md, and verify bundled fonts and samples separately", "story"],
|
|
65
|
-
["For audience exploration, use native UI controls or
|
|
66
|
+
["For audience exploration, use native UI controls or work.free; keep deterministic results in flow steps. Read demo before using drag, hover, scroll or plugin actions", "demo"],
|
|
66
67
|
["Components outside the catalog may exist as plugins: install the npm package, add it to config({ plugins }), then read npx joplo skill <plugin id> before writing its components", "plugins"],
|
|
67
68
|
];
|
|
68
69
|
/** 中文触发词:技能 description 里的匹配文本,不是 CLI 界面文案(english-output 测试的白名单)。 */
|
|
69
70
|
const ZH_JOPLO = '功能原型、可交互演示、方案对比、给产品 / 设计 / 评审看的演示、讲解视频、科普、教程、资讯解读';
|
|
70
71
|
const ZH_FEEDBACK = '本地评审、监听反馈、确认方案、评审有结论了、按评审意见修改演示';
|
|
71
|
-
const JOPLO_DESCRIPTION = `
|
|
72
|
+
const JOPLO_DESCRIPTION = `Author playable, interactive shows with Joplo when the user wants to compare feature options and cases, explain an architecture, call chain or code change, or tell a story, explain news or trace a product's history, and deliver by link or embedded player (${ZH_JOPLO}), including an A/B comparison, a feature prototype, a clickable demo for product, design, or review, and work in a repo without joplo.config.ts, but not production backends, slide decks, PPT, or editing real video footage.`;
|
|
72
73
|
const FEEDBACK_DESCRIPTION = `Receive and apply Joplo review feedback when the user wants to test a local demo, start or resume a feedback listener (npx joplo feedback watch --local --follow), confirm an option, monitor a Share review, or implement review conclusions (${ZH_FEEDBACK}); covers local live events and Cloud polling, without requiring a share for local review.`;
|
|
73
74
|
const list = (items) => items.map((s, i) => `${i + 1}. ${s}`);
|
|
74
75
|
function joploBody() {
|
|
@@ -90,7 +91,9 @@ function joploBody() {
|
|
|
90
91
|
'',
|
|
91
92
|
'## Quick start',
|
|
92
93
|
'```sh',
|
|
93
|
-
'npx joplo@latest init demo
|
|
94
|
+
'npx joplo@latest init demo # compare feature options (default starter)',
|
|
95
|
+
'# Or: npx joplo@latest init demo --template work # one standalone show',
|
|
96
|
+
'cd demo && npm install # an existing project uses its installed npx joplo',
|
|
94
97
|
'npx joplo check # compile and validate; fix until 0 errors',
|
|
95
98
|
'npx joplo dev # stdout: the board URL; stderr: the feedback command for agents',
|
|
96
99
|
'npx joplo feedback watch . --local --follow --json # in its own long-running shell: reviewer feedback as NDJSON',
|
|
@@ -98,9 +101,9 @@ function joploBody() {
|
|
|
98
101
|
'Run dev and the follower in separate long-running shells. dev keeps the board live: every saved edit recompiles and refreshes it.',
|
|
99
102
|
'',
|
|
100
103
|
'## Workflow',
|
|
101
|
-
'1. No joplo.config.ts yet: npx joplo@latest init <dir
|
|
104
|
+
'1. No joplo.config.ts yet: npx joplo@latest init <dir> for feature comparisons, add --template work for a standalone show, or use . 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.',
|
|
102
105
|
...list(START_ORDER).map(line => line.replace(/^(\d+)/, (_, n) => String(Number(n) + 1))),
|
|
103
|
-
`${START_ORDER.length + 2}. Only when the user asks to share or publish: npx joplo share --private --no-review --format json publishes picked options; npx joplo share --private --review also publishes a separate, always-private link containing every option for reviewers (data.review.url); data.url is the main link. For scoped review results with data.mode = review, only the private review was published and its link is data.url; read skill publish for this boundary. Confirming an option in the board is not a publish request. To share part of the project, add --scenario <scenario id> or --
|
|
106
|
+
`${START_ORDER.length + 2}. Only when the user asks to share or publish: npx joplo share --private --no-review --format json publishes picked options; npx joplo share --private --review also publishes a separate, always-private link containing every option for reviewers (data.review.url); data.url is the main link. For scoped review results with data.mode = review, only the private review was published and its link is data.url; read skill publish for this boundary. Confirming an option in the board is not a publish request. To share part of the project, add --scenario <scenario id> or --work <entry key> (repeatable): everything else stays out of the uploaded files; tell the user about any data.scope.borrowed items.`,
|
|
104
107
|
'',
|
|
105
108
|
'## Show the product, not slides',
|
|
106
109
|
'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.',
|
|
@@ -115,7 +118,7 @@ function joploBody() {
|
|
|
115
118
|
'The user reviews in the board: they click through scenarios, write comments with the board\'s native feedback icon, and may confirm (approve) an option. You receive each event the moment it is saved.',
|
|
116
119
|
'1. Start npx joplo feedback watch <dir> --local --follow --json in its own long-running shell (joplo dev prints this exact command; the board\'s feedback panel can copy it too). One follower covers every option of the project and attaches by itself to the new round each source edit opens.',
|
|
117
120
|
'2. Then give the user the board URL that dev printed (do not assume port 4790) and point them to the native feedback icon. If they want to drive the UI themselves, only give the link.',
|
|
118
|
-
'3. While they test, read the follower\'s output with short waits (about 1–5 seconds). Each stdout line is one JSON event (feedback, approved, closed) carrying eventId,
|
|
121
|
+
'3. While they test, read the follower\'s output with short waits (about 1–5 seconds). Each stdout line is one JSON event (feedback, approved, closed) carrying eventId, workId, sessionId and context (route, scenario, step, source); deduplicate by eventId. A background shell alone does not wake an idle agent: stay in a receive loop, and do not claim you are still listening after ending your response unless the host can resume you.',
|
|
119
122
|
' - If you will end your response while the user tests, and your host wakes you when a background command finishes (a host configured to resume on process exit does): run the follower in the background with --once added. It exits 0 on the first feedback or approval, which wakes you. Handle the events, then start it again with --since <createdAt of the last event> (the exit message prints this exact command) so nothing is replayed or lost. Without such a host, tell the user to message you after they confirm.',
|
|
120
123
|
'4. On feedback, acknowledge the actual text and its page/step right away, in the reviewer\'s language, then keep listening. Change the demo only when the user asked for changes; after edits, run npx joplo check. closed (source_changed) is then expected and the follower moves to the new round.',
|
|
121
124
|
'5. approved confirms that option version only: it is not proof the feedback was implemented and not permission to publish. The follower ends with exit 1 only when the board stops (restart dev, then the follower) or 130 on Ctrl+C.',
|
|
@@ -123,7 +126,7 @@ function joploBody() {
|
|
|
123
126
|
'',
|
|
124
127
|
'## Other ways to work together',
|
|
125
128
|
'- Pointing at something: after the user Alt+clicks a board element, run npx joplo selection and edit only that location.',
|
|
126
|
-
'- Designing a product with Joplo itself: keep one project with stable feature IDs and multiple
|
|
129
|
+
'- Designing a product with Joplo itself: keep one project with stable feature IDs and multiple works/scenarios (repository example: examples/joplo). Preserve actual evidence and label historical reconstructions; never invent review or approval history. Public design narration must be curated into visible scenarios because build strips private authoring fields. Details: npx joplo skill authoring.',
|
|
127
130
|
'- CI publication (only when authorized): separate PR comparison previews from the fixed main share, isolate credentials from author-code builds, and verify actual workflow runs after activation. A PR preview is published only while the PR is still open, so do not merge before its comparison link appears. Details: npx joplo skill diff.',
|
|
128
131
|
'- Comparing versions or a PR: read npx joplo skill diff. Preserve stable .key() identities, treat repeated candidates as uncertain, and build two real publish versions. If an embedded player changes scenario independently, use Realign and wait for both target positions before resuming. Use prepare → uncredentialed build → trusted publish only within the user\'s authorized scope.',
|
|
129
132
|
'',
|
|
@@ -154,7 +157,7 @@ function feedbackBody() {
|
|
|
154
157
|
'npx joplo feedback watch ./demo --local --follow --json # keep running in its own shell',
|
|
155
158
|
'```',
|
|
156
159
|
'- --follow streams every option of the project and attaches to the new round each source edit opens; approving one option does not stop it. It exits 1 when the board stops (restart dev, then rerun it) and 130 on Ctrl+C.',
|
|
157
|
-
'- stdout carries one JSON event per line (feedback, approved, closed) with eventId, sessionId,
|
|
160
|
+
'- stdout carries one JSON event per line (feedback, approved, closed) with eventId, sessionId, workId, revision, seq and context; stderr is status, not feedback. Buffer partial lines and deduplicate by eventId: a restart replays the open rounds.',
|
|
158
161
|
'- Start the follower before giving the reviewer the URL dev printed (do not assume port 4790). Point them to the native draggable feedback icon, not a button inside the demo; if they want to operate the UI themselves, only give the link.',
|
|
159
162
|
'- While they test, read the shell output with short tool waits (about 1–5 seconds). A background shell alone does not wake an idle agent: stay in a receive loop or use the host\'s notifications. Do not end your response claiming you are still listening unless the host can resume you; if you must yield, say so, and drain pending output before unrelated work.',
|
|
160
163
|
'- On feedback, acknowledge the actual text and page/step right away in the reviewer\'s language, then keep listening. A delivery test is not a request to implement; if implementation was already requested, acknowledge first, then make the scoped change without asking again.',
|
|
@@ -162,7 +165,7 @@ function feedbackBody() {
|
|
|
162
165
|
'',
|
|
163
166
|
'Example stdout line and an immediate reply:',
|
|
164
167
|
'```json',
|
|
165
|
-
'{"source":"local","type":"feedback","eventId":"rv_…:1","sessionId":"rv_…","
|
|
168
|
+
'{"source":"local","type":"feedback","eventId":"rv_…:1","sessionId":"rv_…","workId":"invite.a-modal","seq":1,"body":"Make the invite button clearer","context":{"route":"/members","scenarioId":"invite.a-modal.happy","position":2}}',
|
|
166
169
|
'```',
|
|
167
170
|
'Reply: Received your feedback on /members, step 2: "Make the invite button clearer." Then keep listening, or make that change if the user already asked you to apply feedback.',
|
|
168
171
|
'',
|
|
@@ -171,12 +174,12 @@ function feedbackBody() {
|
|
|
171
174
|
'npx joplo feedback list ./demo --local --json',
|
|
172
175
|
'npx joplo feedback watch ./demo --local --session <id-from-list> [--after <last-handled-seq>] --json',
|
|
173
176
|
'```',
|
|
174
|
-
'- Use it to wait for one option version\'s approval (exit 0 only on approval, 1 if the round closes) or to resume a round from a cursor. Match projectDir,
|
|
177
|
+
'- Use it to wait for one option version\'s approval (exit 0 only on approval, 1 if the round closes) or to resume a round from a cursor. Match projectDir, workId, instanceId and revision from list; if several match, choose explicitly instead of taking the newest.',
|
|
175
178
|
'- Source edits close that round: list again and attach to the new one with its own cursor. Never reuse an old cursor on a new session or delete review records to reset a round.',
|
|
176
179
|
'',
|
|
177
180
|
'## Share review: poll, do not pretend it is a lossless stream',
|
|
178
181
|
'```sh',
|
|
179
|
-
'npx joplo feedback watch --share <share-id> --
|
|
182
|
+
'npx joplo feedback watch --share <share-id> --work <feature.option> --interval 15 --json',
|
|
180
183
|
'```',
|
|
181
184
|
'- Polling defaults to 15 seconds; --interval accepts 10–30. Pin --version <n> when the version is known; otherwise the first response sets it.',
|
|
182
185
|
'- Only the target version\'s owner pick ends this watcher. Votes, rule confirmations, other options, and older versions do not. A replaced share version emits closed and exits 1.',
|
|
@@ -185,7 +188,7 @@ function feedbackBody() {
|
|
|
185
188
|
'',
|
|
186
189
|
'## Apply conclusions when requested',
|
|
187
190
|
'- Locate the code with feedback.context.source, scenarioId, position, stepId, and element, and check the source is still that revision. Missing Cloud route/source fields are unknown, not permission to guess. For an explicit Alt-click selection use npx joplo selection.',
|
|
188
|
-
'- pick: set pick in features/<feature>/feature.ts to the option file name (targetId without the "<feature>." prefix). A local approved names its
|
|
191
|
+
'- pick: set pick in features/<feature>/feature.ts to the option file name (targetId without the "<feature>." prefix). A local approved names its workId; apply the pick only within the requested task.',
|
|
189
192
|
'- confirm_rule: set that rule to origin: \'user\', status: \'confirmed\'.',
|
|
190
193
|
'- reject_rule: rewrite the rule as the note says. If the alternative is unspecified, set status: \'conflict\' and ask the user; do not guess.',
|
|
191
194
|
'- answer: delete the question and add a rule stating the answer with origin: \'user\', status: \'confirmed\'.',
|
|
@@ -217,7 +220,7 @@ export function skillMarkdown(skill) {
|
|
|
217
220
|
export function agentsBlock() {
|
|
218
221
|
return [
|
|
219
222
|
'## Joplo',
|
|
220
|
-
'This project
|
|
223
|
+
'This project authors Joplo works (standalone pieces and feature demos) (joplo.config.ts). Read npx joplo skill first, then the relevant topics: authoring for works, slices, capabilities and project files, 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, review for live local feedback, Share polling, prompt acknowledgements, and recovery.',
|
|
221
224
|
`Mental model: ${MENTAL_MODEL.slice(0, 5).join(' ')}`,
|
|
222
225
|
`Start: ${START_ORDER.map((s, i) => `(${i + 1}) ${s}`).join(' ')}`,
|
|
223
226
|
'Pitfalls:',
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** 作品按位置校验;两处创作定义直接进入同一编译循环,不合成其他容器。 */
|
|
2
|
+
import type { WorkDef } from '@joplo-app/kit';
|
|
3
|
+
import type { Diagnostic } from './result.js';
|
|
4
|
+
type Report = (code: string, message: string, at?: string, severity?: Diagnostic['severity']) => void;
|
|
5
|
+
export declare function validateWork(key: string, f: WorkDef & {
|
|
6
|
+
file: string;
|
|
7
|
+
}, feature: boolean, report: Report, hasPages?: boolean): boolean;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { isNode } from '@joplo-app/kit/node';
|
|
2
|
+
const record = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
3
|
+
export function validateWork(key, f, feature, report, hasPages = false) {
|
|
4
|
+
const at = f?.source ?? `${f?.file ?? `works/${key}.tsx`}:1:1`;
|
|
5
|
+
if (!f || f.kind !== 'work') {
|
|
6
|
+
report('WORK_INVALID', `Work ${key} must default export work({...})`, at);
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
let valid = true;
|
|
10
|
+
const invalid = (reason) => { report('WORK_INVALID', `Work ${key}: ${reason}`, at); valid = false; };
|
|
11
|
+
if (typeof f.title !== 'string' || !f.title.trim())
|
|
12
|
+
invalid('requires a non-empty title');
|
|
13
|
+
if (typeof f.summary !== 'string' || !f.summary.trim())
|
|
14
|
+
invalid('requires a non-empty summary');
|
|
15
|
+
if (!record(f.scenarios))
|
|
16
|
+
invalid('scenarios must be an object of flow(...) or chapter(...) entries');
|
|
17
|
+
if (f.stage !== undefined && f.layers !== undefined)
|
|
18
|
+
invalid('stage and layers cannot be combined; choose one');
|
|
19
|
+
if (f.stage !== undefined && !isNode(f.stage))
|
|
20
|
+
invalid('stage must be a JSX element');
|
|
21
|
+
if (f.layers !== undefined && !record(f.layers))
|
|
22
|
+
invalid('layers must be an object of layer(...) entries');
|
|
23
|
+
if (!hasPages && f.stage === undefined && f.layers === undefined && f.on === undefined && f.routes === undefined)
|
|
24
|
+
invalid('requires stage, layers, on or routes when the project has no pages');
|
|
25
|
+
if (!valid)
|
|
26
|
+
return false;
|
|
27
|
+
const forbidden = feature ? ['audience', 'roles', 'draft', 'order'] : ['cases', 'focus', 'tradeoffs', 'coverage', 'rules', 'questions'];
|
|
28
|
+
for (const field of forbidden)
|
|
29
|
+
if (Object.hasOwn(f, field))
|
|
30
|
+
report(feature ? 'WORK_STANDALONE_ONLY' : 'WORK_FEATURE_ONLY', `Work ${key}: ${field} is only available ${feature ? 'on an independent work' : 'under a feature for design review'}`, at);
|
|
31
|
+
for (const [sliceKey, slice] of Object.entries(f.scenarios)) {
|
|
32
|
+
if (!slice || !['flow', 'chapter'].includes(slice.kind) || !Array.isArray(slice.steps) || !record(slice.opts)) {
|
|
33
|
+
report('WORK_INVALID', `Work ${key} slice "${sliceKey}" must be flow(title, settings?) or chapter(title, settings?)`, slice?.source ?? at);
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (feature)
|
|
37
|
+
continue;
|
|
38
|
+
if (Object.hasOwn(slice.opts, 'cases'))
|
|
39
|
+
report('WORK_FEATURE_ONLY', `Work ${key} slice "${sliceKey}" cannot declare cases. Remove cases, or use an alternative under a feature`, slice.source ?? at);
|
|
40
|
+
for (const st of slice.steps)
|
|
41
|
+
for (const effect of st.effects)
|
|
42
|
+
if (effect.type === 'uses')
|
|
43
|
+
report('WORK_FEATURE_ONLY', `Work ${key} slice "${sliceKey}" cannot use uses(). Remove uses(), or use an alternative under a feature with rules`, st.source ?? slice.source ?? at);
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}
|
package/dist/catalog.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import type { PluginDataSpec, ElementTraits } from '@joplo-app/kit/plugin';
|
|
|
2
2
|
export declare const COMPONENT_TYPES: readonly ["Custom", "#text", "#fragment"];
|
|
3
3
|
export type ComponentType = (typeof COMPONENT_TYPES)[number];
|
|
4
4
|
export type ComponentInfo = {
|
|
5
|
+
label?: import('@joplo-app/kit/plugin').PluginText;
|
|
6
|
+
inspect?: import('@joplo-app/kit/plugin').PluginInspectField[];
|
|
5
7
|
interactive?: boolean;
|
|
6
8
|
parent?: string;
|
|
7
9
|
needsId?: boolean;
|
package/dist/compile.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConfigDef, FeatureDef, LayoutDef,
|
|
1
|
+
import type { ConfigDef, FeatureDef, LayoutDef, WorkDef, PageDef } from '@joplo-app/kit';
|
|
2
2
|
import { Project } from './schema.js';
|
|
3
3
|
import type { Diagnostic } from './result.js';
|
|
4
4
|
import { type CompileOptions } from './plugins/compiler.js';
|
|
@@ -19,10 +19,14 @@ export type AuthoringProject = {
|
|
|
19
19
|
def: FeatureDef & {
|
|
20
20
|
file: string;
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
works: Record<string, WorkDef & {
|
|
23
23
|
file: string;
|
|
24
24
|
}>;
|
|
25
25
|
}>;
|
|
26
|
+
/** 独立作品文件名为条目键;未声明独立作品时可省略。 */
|
|
27
|
+
works?: Record<string, WorkDef & {
|
|
28
|
+
file: string;
|
|
29
|
+
}>;
|
|
26
30
|
/** 作者主题(D51):themes/<name>.css 的原文。 */
|
|
27
31
|
themes?: Record<string, string>;
|
|
28
32
|
/** 作者内容译文(D84):locales/<语言>.json 的内容(原文 → 译文);语言 → 文件相对路径见 localeFiles。 */
|
|
@@ -35,6 +39,5 @@ export type CompileResult = {
|
|
|
35
39
|
};
|
|
36
40
|
export type CompileMode = 'dev' | 'publish' | 'review';
|
|
37
41
|
export declare function compile(src: AuthoringProject, mode: CompileMode, opts?: CompileOptions): CompileResult;
|
|
38
|
-
/** 角色的颜色(D56):没写 color 时按声明顺序取。 */
|
|
39
42
|
export declare const ROLE_COLORS: readonly ["#E8590C", "#1971C2", "#2F9E44", "#9C36B5", "#C2255C", "#0C8599"];
|
|
40
43
|
export declare function relSource(root: string, s: string): string;
|