@easysociable/cli 0.1.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.
Files changed (69) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +95 -0
  3. package/bin/easysociable.js +15 -0
  4. package/dist/easysociable.js +35464 -0
  5. package/dist/easysociable.js.map +1 -0
  6. package/package.json +58 -0
  7. package/skills/ONBOARDING.md +61 -0
  8. package/skills/easysociable-content/SKILL.md +115 -0
  9. package/skills/easysociable-content/platforms/claude.md +5 -0
  10. package/skills/easysociable-content/platforms/codex.md +5 -0
  11. package/skills/easysociable-content/platforms/hermes.md +5 -0
  12. package/skills/easysociable-content/platforms/openclaw.md +5 -0
  13. package/skills/easysociable-content/references/CLI.md +27 -0
  14. package/skills/easysociable-content/references/MCP.md +20 -0
  15. package/skills/easysociable-content/references/PAGE_PACK.md +6 -0
  16. package/skills/easysociable-content/references/TROUBLESHOOTING.md +11 -0
  17. package/skills/easysociable-content/references/VAULT.md +20 -0
  18. package/skills/easysociable-content/scripts/setup.mjs +156 -0
  19. package/skills/easysociable-content/scripts/setup.test.mjs +71 -0
  20. package/skills/easysociable-content/scripts/starter.mjs +53 -0
  21. package/skills/easysociable-content/workflows/ANALYSIS_AND_COVERAGE.md +8 -0
  22. package/skills/easysociable-content/workflows/CONTENT_EXPORT.md +19 -0
  23. package/skills/easysociable-content/workflows/DEVICE_TASKS.md +5 -0
  24. package/skills/easysociable-content/workflows/EXPERIMENTS.md +6 -0
  25. package/skills/easysociable-content/workflows/MCP_FIRST.md +10 -0
  26. package/skills/easysociable-content/workflows/PUBLICATION.md +5 -0
  27. package/skills/easysociable-content/workflows/TOPIC_DRAFT.md +5 -0
  28. package/skills/easysociable-content/workflows/WORKING_DRAFT.md +10 -0
  29. package/skills/easysociable-slideshow/SKILL.md +77 -0
  30. package/skills/easysociable-slideshow/references/CONTENT_PACK.md +25 -0
  31. package/skills/easysociable-slideshow/references/GATEWAY.md +16 -0
  32. package/skills/easysociable-slideshow/references/PLATFORM_CAPS.md +17 -0
  33. package/skills/easysociable-slideshow/references/VAULT.md +18 -0
  34. package/skills/easysociable-slideshow/workflows/CREATE_RUN.md +7 -0
  35. package/skills/easysociable-slideshow/workflows/MCP_FIRST.md +14 -0
  36. package/skills/easysociable-slideshow/workflows/OUT_OF_SCOPE.md +8 -0
  37. package/skills/easysociable-slideshow/workflows/PUBLISH_RUN.md +4 -0
  38. package/skills/easysociable-slideshow/workflows/RENDER_RUN.md +6 -0
  39. package/skills/easysociable-template/SKILL.md +106 -0
  40. package/skills/easysociable-template/references/AUTHORING_SOURCE.md +129 -0
  41. package/skills/easysociable-template/references/CATALOG_METADATA.md +221 -0
  42. package/skills/easysociable-template/references/DESIGN_INTELLIGENCE.md +69 -0
  43. package/skills/easysociable-template/references/DESIGN_V2_1.md +278 -0
  44. package/skills/easysociable-template/references/EXTERNAL_RESOURCES.md +52 -0
  45. package/skills/easysociable-template/references/GATEWAY.md +25 -0
  46. package/skills/easysociable-template/references/PLATFORM_SPECS.md +134 -0
  47. package/skills/easysociable-template/references/SLOTS.md +104 -0
  48. package/skills/easysociable-template/references/THEME_PRESETS.md +48 -0
  49. package/skills/easysociable-template/references/THEME_TOKENS.md +89 -0
  50. package/skills/easysociable-template/references/fixtures/surface-gradient.design-plan.json +74 -0
  51. package/skills/easysociable-template/references/theme-presets.json +95 -0
  52. package/skills/easysociable-template/scripts/generate-theme-from-hex.mjs +402 -0
  53. package/skills/easysociable-template/scripts/validate-authoring-source.mjs +228 -0
  54. package/skills/easysociable-template/scripts/validate-design-v2.mjs +318 -0
  55. package/skills/easysociable-template/workflows/ASSET_PLAN.md +34 -0
  56. package/skills/easysociable-template/workflows/AUTHORING_FROM_BRIEF.md +52 -0
  57. package/skills/easysociable-template/workflows/AUTHORING_FROM_IMAGE.md +52 -0
  58. package/skills/easysociable-template/workflows/AUTHORING_STUDIO.md +122 -0
  59. package/skills/easysociable-template/workflows/DESIGN_BRIEF.md +92 -0
  60. package/skills/easysociable-template/workflows/DESIGN_CONCEPTS.md +41 -0
  61. package/skills/easysociable-template/workflows/DESIGN_PHILOSOPHY.md +69 -0
  62. package/skills/easysociable-template/workflows/FILL_AND_RENDER.md +86 -0
  63. package/skills/easysociable-template/workflows/MCP_FIRST.md +9 -0
  64. package/skills/easysociable-template/workflows/OUT_OF_SCOPE.md +15 -0
  65. package/skills/easysociable-template/workflows/PALETTE_REVIEW.md +71 -0
  66. package/skills/easysociable-template/workflows/PUBLISH_FROM_DRAFT.md +60 -0
  67. package/skills/easysociable-template/workflows/SURFACE_REVIEW.md +178 -0
  68. package/skills/easysociable-template/workflows/THEME_FROM_BRAND.md +73 -0
  69. package/skills/easysociable-template/workflows/VISUAL_QA.md +55 -0
@@ -0,0 +1,5 @@
1
+ # Deferred in V1
2
+
3
+ Device automation, iPhone publishing, Desktop tasks and Local API workflows are
4
+ not part of the V1 Content Skill. Do not invoke or document them as fallback
5
+ paths. Keep this file as a migration marker only.
@@ -0,0 +1,6 @@
1
+ # Deferred in V1
2
+
3
+ Experiments, hypotheses, metrics and proposal activation are retained only as
4
+ historical documentation. The V1 Content Skill does not expose these commands
5
+ or a backend. Write any future notes as ordinary Markdown in the Obsidian
6
+ Vault; do not create hosted experiment records.
@@ -0,0 +1,10 @@
1
+ # Obsidian-first workflow
2
+
3
+ There is no Content MCP fallback in V1. Use local filesystem tools to set up or
4
+ validate the existing Obsidian Vault, write the Run and platform Pack under
5
+ `Content Engine/runs/<slug>/` or `内容引擎/成稿/<slug>/`, then use the unified EasySociable MCP for hosted
6
+ Template/Slideshow operations. If the MCP is unavailable, use equivalent
7
+ `easysociable` CLI commands.
8
+
9
+ Never start a Local API, open SQLite or switch to the retired
10
+ `easysociable-content` binary.
@@ -0,0 +1,5 @@
1
+ # Deferred in V1
2
+
3
+ V1 does not provide publication, social posting, metrics, retrospectives or
4
+ UGC/SEO projections. Keep the generated Pack and final PNG export in the local
5
+ Obsidian Run; do not call a retired `easysociable-content` command.
@@ -0,0 +1,5 @@
1
+ # Topic and draft notes
2
+
3
+ Never invent hosted IDs. V1 has no publication endpoint; call a draft complete
4
+ only when the local Run and platform Pack have been written to the Obsidian
5
+ Vault.
@@ -0,0 +1,10 @@
1
+ # Local working draft
2
+
3
+ V1 has no Working Draft CLI or Content MCP. Store the working draft as
4
+ Markdown/JSON inside the locale run folder (`Content Engine/runs/<slug>/` or
5
+ `内容引擎/成稿/<slug>/`), then
6
+ write the platform Pack before handing off to the Template or Slideshow Skill.
7
+
8
+ Never treat a local draft as a final render. The final checkpoint is the PNG
9
+ and `manifest.json` written by the unified `easysociable` CLI after the user
10
+ confirms the Studio preview.
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: easysociable-slideshow
3
+ description: >
4
+ Create and review temporary multi-page Slideshow Runs for EasySociable from a
5
+ local Obsidian Content Pack. Use the unified `easysociable` CLI or MCP, open
6
+ Studio for preview, and perform final PNG rendering only after confirmation.
7
+ There is no Slideshow Template product, UGC publishing, social posting or
8
+ separate Slideshow CLI/MCP in V1.
9
+ ---
10
+
11
+ # EasySociable Slideshow Skill
12
+
13
+ A Slideshow Run is a temporary composition of explicit single-page Templates.
14
+ It is not a reusable Carousel/Deck Template and it is not a public post.
15
+
16
+ ## Rules
17
+
18
+ 1. Read a local `content-pack.v1` from the Obsidian Content Engine.
19
+ 2. Use the unified `easysociable` CLI or the unified MCP server. All hosted
20
+ calls go through Gateway; never call Directus, R2, Stripe or private services.
21
+ 3. The Agent must choose a Profile, one Theme and an explicit Page Template for
22
+ every page. The server never silently chooses or replaces a Page Template.
23
+ 4. A Run has 1–20 pages, one supported platform (`tiktok`, `instagram`,
24
+ `linkedin` or `threads`) and one Profile/Theme across all pages.
25
+ 5. Topology is fixed after creation: no add, copy, delete, reorder or template
26
+ switch. Page-instance slot/layout/type/style/decoration edits remain allowed
27
+ in Studio.
28
+ 6. Studio is preview-only. It has no final download, publish, unpublish, UGC,
29
+ SEO/GEO or social-posting action.
30
+ 7. Agent revisions update the same unexpired Run. Studio activity extends the
31
+ seven-day TTL. Expired Runs are not recoverable through the public API.
32
+ 8. Preview is free but rate/concurrency limited. Final rendering is PNG-only,
33
+ uses one atomic reservation for all pages and charges only when every page
34
+ succeeds.
35
+
36
+ ## Workflow
37
+
38
+ 1. Validate the Pack and platform/page count.
39
+ 2. Resolve or create the user's Profile/Theme through the unified CLI/MCP.
40
+ 3. Select a compatible published Page Template for every page.
41
+ 4. Call:
42
+
43
+ ```bash
44
+ easysociable slideshows create --file ./pack.json --json
45
+ ```
46
+
47
+ 5. Open the returned `studioUrl` and inspect every page.
48
+ 6. Save Studio edits and wait for the saved revision.
49
+ 7. After explicit confirmation, call:
50
+
51
+ ```bash
52
+ easysociable slideshows render --id run_xxx --idempotency-key run_xxx-final-1 --json
53
+ easysociable slideshows export --id run_xxx --output ./exports/run_xxx/tiktok --json
54
+ ```
55
+
56
+ Hosted finals use one Run capture session + one Imagine deck screenshot
57
+ (single browser load, N page PNGs). Require Studio Save (`layout.studioJson`
58
+ + `themeSnapshot`) before render. Single-page Template jobs still use
59
+ `renders create|wait|export`.
60
+
61
+ 8. Verify checksums and the reconstruction `manifest.json` in the Obsidian
62
+ Run export. The export is the local final deliverable; cloud artifacts expire
63
+ after 24 hours.
64
+
65
+ ## Failure handling
66
+
67
+ - If a page template, slot or image is invalid, return the structured Gateway
68
+ error to the Agent; do not substitute another template.
69
+ - If any final page fails, there is no partial final set and no page charge.
70
+ - Retry the same final request with the same idempotency key to reuse the Job.
71
+ - If the Run is expired, create a new Run from the Pack.
72
+
73
+ ## Handoff boundary
74
+
75
+ The Content Skill owns semantic copy and Pack creation. The Template Skill owns
76
+ single-page authoring and fill-slots. This Skill only composes explicit page
77
+ instances and coordinates preview/final render.
@@ -0,0 +1,25 @@
1
+ # ContentPack v1
2
+
3
+ ```json
4
+ {
5
+ "schemaVersion": "content-pack.v1",
6
+ "platform": "tiktok",
7
+ "title": "A repeatable story",
8
+ "pages": [
9
+ { "role": "hook", "pageTemplateId": "tpl_hook_001", "slots": { "text_0": "The hook", "text_1": "The point" } },
10
+ { "role": "value", "pageTemplateId": "tpl_value_001", "slots": { "text_0": "One idea" } },
11
+ { "role": "cta", "pageTemplateId": "tpl_cta_001", "slots": { "text_0": "Follow for more" } }
12
+ ]
13
+ }
14
+ ```
15
+
16
+ Page `role` is semantic and `pageTemplateId` is the explicit published
17
+ single-page template chosen by the Agent. `slots` are public values only. Do not
18
+ add a `deck_template_id`, `bindingMap`, AST or ContentDocument.
19
+
20
+ The Gateway validates that each selected template supports the page role and
21
+ belongs to the account-visible catalog. It never silently replaces a selection.
22
+
23
+ The renderer accepts any supported page count within the platform cap. A newly
24
+ published Page Template can be selected in a new Run without creating a
25
+ carousel asset.
@@ -0,0 +1,16 @@
1
+ # Slideshow Gateway reference
2
+
3
+ Slideshow uses the unified EasySociable Gateway client and public routes:
4
+
5
+ ```text
6
+ POST /v1/slideshow/runs
7
+ GET /v1/slideshow/runs/{runId}
8
+ PATCH /v1/slideshow/runs/{runId}
9
+ POST /v1/slideshow/runs/{runId}/render
10
+ GET /v1/slideshow/runs/{runId}/studio
11
+ GET /v1/render-jobs/{jobId}
12
+ GET /v1/render-jobs/{jobId}/manifest
13
+ ```
14
+
15
+ There are no V1 publish, unpublish, public-piece or Slideshow-template routes.
16
+ All requests use the account's unified credential and owner isolation.
@@ -0,0 +1,17 @@
1
+ # Platform page caps (ADR-0026)
2
+
3
+ The Run validates only the actual `content-pack.v1.pages.length`. There is no
4
+ `designMax`, full-page deck skeleton, or deck catalog to clone.
5
+
6
+ | platform | hardMin | hardMax | default canvas |
7
+ |---|---:|---:|---|
8
+ | tiktok | 4 | 35 | 9:16 · 1080×1920 |
9
+ | instagram | 2 | 20 | 4:5 · 1080×1350 |
10
+ | linkedin | 2 | 300 | 1:1 · 1080×1080 |
11
+ | x | 2 | 4 | platform-specific X organic image size |
12
+ | xiaohongshu | 2 | 18 | platform-specific vertical image size |
13
+ | threads | 2 | 20 | platform-specific image size |
14
+
15
+ If a pack is outside the cap, stop before creating a Run and ask the agent to
16
+ revise the page count or split the piece. Never silently drop a CTA or pad a
17
+ pack to a product skeleton.
@@ -0,0 +1,18 @@
1
+ # Obsidian export
2
+
3
+ The local Obsidian Run folder is the final delivery mirror:
4
+
5
+ ```text
6
+ Content Engine/ or 内容引擎/
7
+ └── runs/<slug>/ or 成稿/<slug>/
8
+ └── exports/<slug>/<platform>/ or 导出/<slug>/<platform>/
9
+ ├── 01.png
10
+ ├── 02.png
11
+ └── manifest.json
12
+ ```
13
+
14
+ Read `locale.json` in the engine root (`en` or `zh`) and use that tree. Pack JSON keys stay English.
15
+
16
+ The CLI verifies checksums and atomically replaces this directory only after a
17
+ complete atomic Hosted Render succeeds. No ZIP is created. The cloud artifact
18
+ may expire after 24 hours; the local PNGs remain the user's files.
@@ -0,0 +1,7 @@
1
+ # Create Run
2
+
3
+ 1. Build `content-pack.v1` from the agent's semantic outline.
4
+ 2. Check platform hardMin/hardMax.
5
+ 3. Call `create_run` or `run create` through Gateway.
6
+ 4. Save `runId`, `studioUrl`, and `status=draft`.
7
+ 5. Do not call a Deck API or create a carousel template.
@@ -0,0 +1,14 @@
1
+ # MCP-first
2
+
3
+ Use the single unified EasySociable MCP server for Slideshow Run operations.
4
+ Fallback commands use the same Gateway client:
5
+
6
+ ```bash
7
+ easysociable slideshows create --file ./pack.json --json
8
+ easysociable slideshows render --id run_xxx --idempotency-key run_xxx-final-1 --json
9
+ easysociable renders wait --id job_xxx --json
10
+ easysociable renders export --id job_xxx --output ./exports/run_xxx/tiktok --json
11
+ ```
12
+
13
+ Neither path may call a private service, Local API, Directus, R2 or a separate
14
+ Slideshow MCP process.
@@ -0,0 +1,8 @@
1
+ # Out of scope
2
+
3
+ - DeckTemplate creation, `list_decks`, `CREATE_DECK`, or `BIND_P0_DECKS`.
4
+ - ContentDocument as a render input (ADR-0021).
5
+ - Client-side RenderPlan or AST compilation.
6
+ - Full cross-platform Page Template coverage and ad-placement variants.
7
+ - Copy generation, account memory, or publication analytics.
8
+ - UGC/publication, public slugs, SEO/GEO and social posting.
@@ -0,0 +1,4 @@
1
+ # Deferred in V1
2
+
3
+ Slideshow Runs are not published as UGC and have no publish/unpublish action in
4
+ V1. The final deliverable is a locally exported PNG set and `manifest.json`.
@@ -0,0 +1,6 @@
1
+ # Render Run
2
+
3
+ Call `render_slideshow_run` / `slideshows render`. The Agent has already chosen a published Page Template
4
+ for each page role, fills public slot values, and delegates to Hosted Template
5
+ Render. A missing role match is a structured error; the agent must not silently
6
+ replace a page template locally.
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: easysociable-template
3
+ description: >
4
+ Create single-page social image templates for EasySociable via the unified
5
+ Template MCP or `easysociable` CLI, and fill published template slots to Hosted Render
6
+ (get_template → slots → create_render_job). Use when the user wants to author a
7
+ page template from a reference image or text brief, write a shared visual design
8
+ philosophy, explore 2–3 professional layout concepts as spatial expressions of that
9
+ philosophy, plan or generate visual assets, co-create/reuse a Theme with brand-hex
10
+ palette generation, choose a Surface (flat / Gateway gradient catalog / host
11
+ Unsplash·Pexels·Pinterest photo), pull icons via Template Gateway
12
+ search_icons/get_icon (internal Icon Catalog), run
13
+ screenshot-based visual QA, attach catalog metadata (platforms including
14
+ x/linkedin/threads, pageRoles, archetypes, density, slotSummary), open Authoring
15
+ Studio, publish a single-page template, or render a published template by filling
16
+ public slots. Do not use for multi-slide slideshow composition, ContentDocument as
17
+ render input, local content library, or carousel packs.
18
+ ---
19
+
20
+ # EasySociable Template Skill
21
+
22
+ The public entry points are the unified `easysociable` CLI and one unified MCP
23
+ server. Do not install or invoke `easysociable-template`, `easysociable-slideshow`,
24
+ `easysociable-content`, or a separate Content/Slideshow MCP in V1.
25
+
26
+ **This skill owns two single-page paths:**
27
+
28
+ 1. **Author** templates (Studio + Publish).
29
+ 2. **Fill slots → Hosted Render** for a published PageTemplate (`workflows/FILL_AND_RENDER.md`).
30
+
31
+ It is a template factory **and** the Agent surface for single-page fill-slots out图 (ADR-0021). It is **not** a multi-slide slideshow compositor.
32
+
33
+ Every published page must carry **P0 catalog metadata** so Agents can filter and fill templates (`references/CATALOG_METADATA.md`).
34
+
35
+ Out of scope (hand off):
36
+
37
+ - Generating爆款 copy / Working Draft as a **Content** product (Content Skill)
38
+ - Multi-slide slideshow composition / Slideshow Run → **easysociable-slideshow**
39
+ - Local Runtime, SQLite, Content Version library
40
+ - Using `ContentDocument` / `contentDocumentHash` as Template render input
41
+
42
+ ## Rules
43
+
44
+ 1. Prefer the unified EasySociable MCP. Fall back only to the unified `easysociable` CLI.
45
+ 2. Submit only public Gateway DTOs. Never invent or request private Safe AST / Binding Map / RenderPlan.
46
+ 3. Do not start Local Runtime, read content library SQLite, or call Content MCP/CLI for Template work.
47
+ 4. Catalog and create targets are **single-page** only. Never treat site Carousel packs as Agent templates.
48
+ 5. After `create` / `createDraft`, the primary authoring path is `authoringStudioUrl` (`/authoring/{draftId}`). Always send the handoff message in `AUTHORING_STUDIO.md` (edit → **Save** → tell Agent to publish). Do not require a Hosted Preview Job for interactive authoring.
49
+ 6. Studio has **Save only** — no Publish button. Publish only after the user saves and **explicitly** asks to publish; then run `workflows/PUBLISH_FROM_DRAFT.md`.
50
+ 7. **Do not Publish without complete P0 selection metadata** (`CATALOG_METADATA.md`). Gateway enforces this.
51
+ 8. Theme: reuse `themeId` **or** co-create full `ThemeTokens`. Colors/fonts belong in Theme; page nodes use semantic `--es-*` tokens where possible.
52
+ 9. Layout model is **absolute positioning** on a **flat canvas tree** (see prior authoring rules / `AUTHORING_SOURCE.md`).
53
+ 10. **Runtime layout CSS:** put exact geometry in JSX inline `style={{...}}`. Never depend on Tailwind arbitrary-value classes for geometry.
54
+ 11. Run `scripts/validate-authoring-source.mjs` before every create/update.
55
+ 12. `supportedRoles` uses closed **pageRoles**; `platforms` is a multi-select array.
56
+ 13. Canvas sizes must follow `references/PLATFORM_SPECS.md`.
57
+ 14. **Text-only V2.1 authoring:** `DESIGN_BRIEF` → Philosophy → Concepts → assets/surface → author → Visual QA.
58
+ 15. **Visual QA** before Studio handoff when authoring.
59
+ 16. Prefer **reusable/brand assets**, Gateway gradient recipes, and catalog icons for deterministic visuals. Geometric chrome (hairlines, rails, discs) may use plain CSS shapes — **not** as a substitute for named icons.
60
+ 17. Preserve `draftId`, `templateId`, `themeId`, `jobId`, `authoringStudioUrl`, and `previewUrl` across steps.
61
+ 18. **Theme / Surface confirmation gates** unchanged for authoring (see `PALETTE_REVIEW`, `SURFACE_REVIEW`).
62
+ 19. **Fill-slots render (primary consumption path):** `get_template` → fill `slots[]` → `create_render_job({ templateId, slots, output })` → poll Job/Manifest. Image slots always use an account-owned `imageId` from the existing Gateway → R2 + Directus `Image` flow. Never pass a third-party URL, local path, transient `renderAssetId`, ContentDocument or `contentDocumentHash`. See `workflows/FILL_AND_RENDER.md`.
63
+ 20. **Hosted Capture first:** default delivery is Hosted Artifact. Local capture only when the error includes `fallback.capture` — follow `workflows/FILL_AND_RENDER.md` §5 (CLI `capture` or same-URL Playwright). Do not use page html-to-image buttons as the Agent primary path.
64
+ 21. **Icons (hard rule — no shortcuts):**
65
+ - Any **recognizable icon** (arrows, chevrons, checkmarks, social glyphs, UI symbols, “next page” cues, etc.) **MUST** use Gateway Icon Catalog:
66
+ `search_icons` / CLI `icons search` → show ≤8 candidates → **user confirm** (or explicit “你定 / 用第 N 个”) → `get_icon` / CLI `icons get --idempotency-key …` → embed returned **`canonicalSvg`** and record **`iconAssetId`** / `iconId` on the decoration node.
67
+ - **Forbidden by default:** hand-authored SVG `<path>` icons, emoji-as-icon, Iconify/Better Icons MCP, inventing icon markup “because it’s faster”.
68
+ - **Not icons (CSS chrome OK without catalog):** pure geometry with no symbol meaning — e.g. solid rectangle rail, hairline rule, plain circle blob used only as wash.
69
+ - **Degrade only if** search/get fails or catalog unavailable: say so, then offer omit **or** temporary CSS/SVG shape **after user agrees**. Never silently hand-draw when catalog works.
70
+ - Color with `currentColor` / `--es-*`; never bake brand hex into the SVG. Full procedure: `workflows/SURFACE_REVIEW.md` § Icons.
71
+
72
+ ## Bootstrap
73
+
74
+ ```bash
75
+ easysociable auth status --json
76
+ ```
77
+
78
+ ## Intent routing
79
+
80
+ | User intent | Workflow |
81
+ |---|---|
82
+ | Text description → template | `DESIGN_BRIEF.md` → … → `AUTHORING_STUDIO.md` |
83
+ | Reference image → template | `AUTHORING_FROM_IMAGE.md` → … → `AUTHORING_STUDIO.md` |
84
+ | Need gradient / photo surface / icons only | `SURFACE_REVIEW.md` |
85
+ | **Add / change an icon** (arrow, chevron, check, …) | **MUST** `SURFACE_REVIEW.md` § Icons — search → confirm → get_icon. **Do not** hand-draw SVG paths. |
86
+ | Already have authoring payload / continue Studio | `workflows/AUTHORING_STUDIO.md` |
87
+ | User says publish / 发布该模板 (after Save) | `workflows/PUBLISH_FROM_DRAFT.md` |
88
+ | Browse published single-page templates | `list` / `get_template` + public metadata |
89
+ | **Fill a published template → PNG/JPEG** | `workflows/FILL_AND_RENDER.md` |
90
+ | 「做一套多页 slideshow / deck / carousel 出图」 | **Stop multi-slide composition** → **easysociable-slideshow**. Per-page fill-slots render still uses this skill’s `FILL_AND_RENDER` when orchestrated by slideshow. |
91
+
92
+ ## Core model
93
+
94
+ - `references/PLATFORM_SPECS.md`
95
+ - `references/CATALOG_METADATA.md`
96
+ - `references/SLOTS.md` — public slot contract for fill-slots render
97
+ - `references/AUTHORING_SOURCE.md`
98
+ - `references/THEME_TOKENS.md`
99
+ - `references/EXTERNAL_RESOURCES.md`
100
+ - `references/GATEWAY.md` — CLI / MCP including `render` / `create_render_job`
101
+ - `workflows/FILL_AND_RENDER.md` — get_template → slots → Hosted Render
102
+ - Authoring V2.1 workflows + validators as before
103
+
104
+ ## MCP
105
+
106
+ See `workflows/MCP_FIRST.md`.
@@ -0,0 +1,129 @@
1
+ # Authoring source (Agent → Gateway)
2
+
3
+ The Agent produces a public **single-page** `authoringSource`. The server compiles it into private Safe AST / bindings. Clients never receive Binding Map or private AST.
4
+
5
+ ## Required payload shape
6
+
7
+ ```ts
8
+ type AuthoringSource = {
9
+ canvas: { width: number, height: number } // e.g. 1080×1350, 1080×1440
10
+ json: unknown // Studio projection (nodes / snapshot-like structure)
11
+ // optional: data, style, font — only if Gateway/Studio expect them
12
+ }
13
+ ```
14
+
15
+ Provenance on create:
16
+
17
+ ```ts
18
+ source: {
19
+ kind: 'image_reference' | 'text_brief' | 'manual' | 'import'
20
+ brief?: string
21
+ }
22
+ ```
23
+
24
+ ## What the Agent must decide before `create`
25
+
26
+ 1. **Canvas** — width / height + `canvasPreset` from `PLATFORM_SPECS.md` Recommended row + `CATALOG_METADATA.md`.
27
+ 2. **Selection metadata (P0)** — platforms, supportedRoles (pageRoles), contentFamily, contentArchetypes, density, media/slotSummary, shortDescription — see `CATALOG_METADATA.md`. Write `selection-metadata.json` alongside the authoring source.
28
+ 3. **Slot table** — see `SLOTS.md` (`text` / `number` / `image` only; no `list`). Derive `slotSummary` (+ `fixedItemCount` for checklist/steps).
29
+ 4. **Node layout** — flat absolute positions on the canvas; each fillable node has `bindingKey` = slot key.
30
+ 5. **Decoration** — nodes without `bindingKey` (including visual card backgrounds as **siblings**, not parents).
31
+ 6. **Theme** — reuse `themeId` or full `ThemeTokens` create (`THEME_TOKENS.md`).
32
+ 7. **Placeholders** — sample strings/images for Studio preview only.
33
+
34
+ ## Layout model
35
+
36
+ - Nodes are **absolutely positioned** (independent frames) under the canvas frame (`data-type="post"` / Graphic).
37
+ - **Flat tree rule:** every layout node is a **direct child of the canvas frame**, with coordinates relative to the **canvas**, not to another box.
38
+ - **Forbidden:** nesting `position: 'absolute'` inside another `position: 'absolute'` (e.g. `profile-card` wrapping avatar + name + handle). Studio select/drag writes canvas coordinates; nested frames cause elements to jump or move as a group unintentionally.
39
+ - **Allowed text nesting:** a text host (`h1`–`h6`, `p`, `span`, or one absolute text unit) may contain **non-positioned** inline children (emphasis marks, split currency + number spans). Those children must **not** set `position: 'absolute'`.
40
+ - **Visual “card” pattern:** draw the card panel as its own absolute **decoration** sibling; place `img` / name / handle as separate absolute siblings using canvas coordinates (convert any local offsets: `canvasLeft = cardLeft + localLeft`).
41
+ - Do not assume flex/flow reflow when a node is omitted.
42
+ - Empty optional slots → omit node at render (see `SLOTS.md`).
43
+
44
+ Bad — layout group wrapper (absolute inside absolute):
45
+
46
+ ```jsx
47
+ <div
48
+ style={{ position: 'absolute', right: 56, top: 62, width: 270, height: 214 /* card */ }}
49
+ data-type="profile-card"
50
+ >
51
+ <img style={{ position: 'absolute', left: 24, top: 24, width: 76, height: 76 }} /* nested */ />
52
+ <div style={{ position: 'absolute', left: 24, top: 122 }}>Alex Chen</div>
53
+ </div>
54
+ ```
55
+
56
+ Good — flat siblings (card chrome + content share the canvas):
57
+
58
+ ```jsx
59
+ <div
60
+ style={{ position: 'absolute', left: 874, top: 62, width: 270, height: 214 /* panel only */ }}
61
+ data-type="decoration"
62
+ />
63
+ <img
64
+ style={{ position: 'absolute', left: 898, top: 86, width: 76, height: 76 }}
65
+ data-type="image"
66
+ />
67
+ <div style={{ position: 'absolute', left: 898, top: 184, width: 220 }} data-type="title">
68
+ Alex Chen
69
+ </div>
70
+ ```
71
+
72
+ ## Studio runtime CSS contract
73
+
74
+ Authoring Studio loads `authoringSource.json` **at runtime**. Tailwind only emits CSS for classes found during the Studio build, so remote arbitrary-value utilities have no guaranteed CSS.
75
+
76
+ For every value that controls composition, use JSX inline styles:
77
+
78
+ - Geometry: `position`, `left`, `right`, `top`, `bottom`, `width`, `height`
79
+ - Critical type: `fontSize`, `lineHeight`, `letterSpacing`, `fontWeight`
80
+ - Runtime Theme values: `var(--es-color-*)`, `var(--es-font-*)`, `var(--es-surface-*)`
81
+
82
+ Bad — class names exist in the DOM but their CSS may not:
83
+
84
+ ```jsx
85
+ <h1 className="absolute left-[56px] top-[120px] w-[720px] text-[42px]">
86
+ Revenue
87
+ </h1>
88
+ ```
89
+
90
+ Good — deterministic after runtime loading:
91
+
92
+ ```jsx
93
+ <h1
94
+ style={{
95
+ position: 'absolute',
96
+ left: 56,
97
+ top: 120,
98
+ width: 720,
99
+ fontSize: 42,
100
+ color: 'var(--es-color-text,#F7F9F9)',
101
+ fontFamily: 'var(--es-font-heading,Inter)',
102
+ }}
103
+ >
104
+ Revenue
105
+ </h1>
106
+ ```
107
+
108
+ Use `className` only for non-critical static utilities known to exist in the Studio bundle. Never use Tailwind arbitrary-value tokens (`...-[...]`) for authoring geometry, typography, or Theme colors.
109
+
110
+ Before create/update, run the bundled validator relative to this Skill directory:
111
+
112
+ ```bash
113
+ node scripts/validate-authoring-source.mjs ./authoring-source.json
114
+ ```
115
+
116
+ Treat any validator error as blocking.
117
+
118
+ ## Forbidden in Agent output
119
+
120
+ - Private Safe AST as if it were the public contract
121
+ - `bindingMap` / full bindings objects in Gateway requests
122
+ - Multi-page / carousel pack structures
123
+ - Claiming pixel-perfect recreation of a competitor poster without Studio review
124
+ - Critical runtime layout expressed with Tailwind arbitrary-value classes
125
+
126
+ ## Hand-off
127
+
128
+ After create, open `authoringStudioUrl` and send the handoff message in `AUTHORING_STUDIO.md`.
129
+ User edits and **Saves** in Studio (no Publish button). Agent publishes only after the user asks — see `PUBLISH_FROM_DRAFT.md`.