@easysociable/cli 0.1.10 → 0.1.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easysociable/cli",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Agent-first CLI for EasySociable: Content Engine, Template, Slideshow, and MCP",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -11,7 +11,7 @@ description: >
11
11
  Triggers: 推荐产品, 评测工具, compare tools, review an AI product
12
12
  — edit `recommendations/`; do not treat third-party subjects as owned Products.
13
13
  Triggers: 做成选题, 开一单, 出图
14
- — follow engine CLAUDE.md (§ Topics / § Open a run / § PagePack).
14
+ — follow engine CLAUDE.md (§ Topics / § Open a run / § PagePack: Page Contracts → Media → Template Selection before templates).
15
15
  If no engine exists, copy/clone the Content Engine core (see Create below;
16
16
  `easysociable engine init` is optional offline scaffold). Then follow
17
17
  Content Engine/CLAUDE.md. Render handoff: easysociable-template (1 page) or
@@ -131,9 +131,9 @@ CLI republishes.
131
131
  | 扫需求选题 | **NEEDS.md** then Topics from `needs/` `status=captured` — **ask `generation_mode` first** |
132
132
  | 做成选题 / 生成 topic | engine **§ Topics** — explicit input; **ask `generation_mode` before write** |
133
133
  | 开一单 / 用 T-… 开一单 | engine **§ Open a run** (ask platform; multi → N runs) |
134
- | 1 page image | **easysociable-template** (after hard gate) |
135
- | 2+ pages on tiktok / instagram / linkedin / threads | **easysociable-slideshow** (after hard gate) |
136
- | x / xiaohongshu images | **easysociable-template** only (after hard gate) |
134
+ | 1 page / `media_mode=single_visual` | **easysociable-template** (after hard gate) |
135
+ | 2+ pages / `media_mode=multi_page_pack` (any platform, incl. X + `pack_hook`) | **easysociable-slideshow** (after hard gate + **ADR-0036 identity chain**: Studio login → API key → `easysociable auth login` → create) |
136
+ | X / xiaohongshu text-only | No render skill — ship copy from the Run |
137
137
 
138
138
  ## Render hard gate
139
139
 
@@ -145,7 +145,7 @@ On fail: **stay in this skill**. List missing files. Do not call template or sli
145
145
  easysociable engine validate --run <run-dir> --require-pack --require-knowledge
146
146
  ```
147
147
 
148
- Slideshow packs need an **Arc** line first. Do not default Cover → Point → Steps → Recap → CTA. Page 1 is not automatically `cover`. Handoff: **easysociable-slideshow** (`references/ARC.md`).
148
+ Slideshow packs need an **Arc** line, then **Page Contracts** (no `templateId`), then Media, then Template Selection. Do not default Cover → Point → Steps → Recap → CTA. Page 1 is cover/hook class; later pages are not. Handoff: **easysociable-slideshow** (`references/ARC.md`). Validate with `python3 scripts/validate-pack.py`.
149
149
 
150
150
  ## Research (Needs)
151
151
 
@@ -25,8 +25,16 @@ Page order is the argument of **this pack**, not a catalog recipe.
25
25
  calls go through Gateway; never call Directus, R2, Stripe or private services.
26
26
  3. Choose a Brand (or Profile/Theme) and an explicit Page Template for every
27
27
  page. The server never silently chooses or replaces a Page Template.
28
- Select by **platform + canvas + slotSummary + density**. `role` is a weak
29
- retrieval tag, not sequence position.
28
+ Prefer templates already chosen on the Content Engine pack (**Template
29
+ Selection** after **Page Contracts**). Otherwise get a shortlist from
30
+ `easysociable slideshows recommend --file contracts.json --seed <slug>`
31
+ (MCP `recommend_slideshow_templates`) and pick one per page with a reason.
32
+ The recommender filters platform + native canvas + slotSummary + cover rule,
33
+ demotes Layout Families used in the owner's recent Runs, and keeps one
34
+ unused family per page. `role` / `supportedRoles` are weak retrieval tags,
35
+ not sequence position. Never browse with bare `templates list` (first 20
36
+ ids only); use `--platform <p> --all` if you must see the full catalog.
37
+ Do not copy a previous pack's Template Selection as the default.
30
38
  4. **Cover / hook placement (hard):** a template is cover/hook class when
31
39
  `supportedRoles` includes `cover` or `hook`. `pages[0]` must use one.
32
40
  Cover/hook class templates must not appear on any later page. Later pages
@@ -55,6 +63,15 @@ Page order is the argument of **this pack**, not a catalog recipe.
55
63
  **easysociable-content** / refuse create; list missing files. Do not add
56
64
  Gateway or MCP params. User must say **强制继续** / **force continue**
57
65
  to call Gateway.
66
+ 8c. **Identity chain (ADR-0036, hard):** before create, the CLI must be
67
+ logged in with the **user's Dashboard Workspace API key** (same account
68
+ that will open Studio). Refuse fixture `workspace_local` / local
69
+ `test-key` unless the user explicitly asked for a local fixture
70
+ (`--allow-local-fixture`). Order: Studio login → create API key →
71
+ `easysociable auth login --api-key <key>` → create Run → open
72
+ `studioUrl` while logged in as that user. If Studio shows “belongs to
73
+ another account”, recreate with the current key — do not invent
74
+ cross-workspace access.
58
75
  9. Preview is free. Free Download is 3 successful ZIPs per month and one
59
76
  platform. Paid Download is unmetered.
60
77
  10. **Forbidden default:** do not assemble Cover → Point → Steps → Recap → CTA
@@ -66,12 +83,17 @@ Page order is the argument of **this pack**, not a catalog recipe.
66
83
  ## Workflow
67
84
 
68
85
  1. Write one arc line (`references/ARC.md`). Do not skip this for a five-family fill-in.
69
- 2. Validate the Pack and platform/page count.
86
+ 2. Validate Page Contracts / pack when present:
87
+ `python3 scripts/validate-pack.py runs/<slug>/pack.md` (in the Content Engine).
88
+ Refuse create if contracts are empty or contain `templateId`.
70
89
  3. Resolve or create the user's Brand through the unified CLI/MCP.
71
- 4. List the published catalog. `pages[0]` must be cover/hook class
72
- (`supportedRoles` includes `cover` or `hook`). Remaining pages: platform +
73
- canvas + slot counts + density — not `beat name == family name`. Never
74
- place a cover/hook class template after page 1.
90
+ 4. Prefer pack **Template Selection** ids. Otherwise run
91
+ `easysociable slideshows recommend --file contracts.json --seed <slug> --json`
92
+ and choose from each page's `candidates`; never place a cover/hook class
93
+ template after page 1. Report `gaps` (pages with < 2 role-matching
94
+ templates) to the user as authoring backlog. Record Layout Family evidence
95
+ as `hypothesis` unless published comparable results support `tested` /
96
+ `supported` — a template having been used before is not evidence.
75
97
  5. List existing Runs when the Pack has a stable content slug:
76
98
 
77
99
  ```bash
@@ -14,3 +14,12 @@ GET /v1/render-jobs/{jobId}/manifest
14
14
 
15
15
  There are no V1 publish, unpublish, public-piece or Slideshow-template routes.
16
16
  All requests use the account's unified credential and owner isolation.
17
+
18
+ ## Identity (ADR-0036)
19
+
20
+ - Create and GET are **owner-scoped**. Same Workspace API key / Studio session
21
+ workspace that created the Run must open Studio.
22
+ - Authenticated GET of another workspace's Run → `403 RUN_WRONG_WORKSPACE`
23
+ (not a silent 404).
24
+ - Fixture `workspace_local` create is blocked under Directus persistence unless
25
+ `SLIDESHOW_ALLOW_FIXTURE_STUDIO=1`. See `docs/operations/studio-identity-chain.md`.
@@ -2,16 +2,26 @@
2
2
 
3
3
  1. Write one arc line (`references/ARC.md`). Forbidden default:
4
4
  Cover → Point → Steps → Recap → CTA.
5
- 2. Build `content-pack.v1` from that argument. Page count follows the beats
6
- (TikTok often 4–8), not the number of P0 families.
7
- 3. Check platform hardMin/hardMax.
8
- 4. List published Page Templates. `pages[0]` must be cover/hook class
9
- (`supportedRoles` includes `cover` or `hook`). Do not use that class on
10
- later pages. Remaining pages: platform + canvas + `slotSummary` + density.
11
- `role` is a weak tag.
12
- 5. If `contentSlug` already has a Run: update only when topology matches
5
+ 2. Prefer a Content Engine `pack.md` that already has **Page Contracts**,
6
+ **Media**, and **Template Selection** filled. If contracts are missing,
7
+ stop and hand back to **easysociable-content** — do not invent page
8
+ purposes from catalog family names.
9
+ 3. Build `content-pack.v1` from that argument. Page count follows the beats
10
+ (TikTok often 4–8), not the number of P0 families. Carry the chosen
11
+ `pageTemplateId`s from Template Selection (explicit — server must not
12
+ silent-replace).
13
+ 4. Check platform hardMin/hardMax.
14
+ 5. No Template Selection on the pack → shortlist with
15
+ `easysociable slideshows recommend --file contracts.json --seed <slug> --json`
16
+ (MCP `recommend_slideshow_templates`). Input is the Page Contracts:
17
+ `{ platform, pages: [{ role, density?, slotSummary?: { text, number, image }, requiresImage? }] }`.
18
+ Pick one candidate per page and record the reason; `supportedRoles` is a
19
+ weak tag. `pages[0]` must be cover/hook class. Do not use that class on
20
+ later pages. W- judgments (`fits` / `avoid`) with comparable evidence may
21
+ override the recommender's order. Surface `gaps` to the user.
22
+ 6. If `contentSlug` already has a Run: update only when topology matches
13
23
  (same page count and `pageTemplateId`s). Otherwise create a new Run.
14
- 6. **Before** `create_run` / `slideshows create` (every create, not only the
24
+ 7. **Before** `create_run` / `slideshows create` (every create, not only the
15
25
  first Run): check the knowledge hard gate — Identity Role / What I build /
16
26
  Point of view have no `(fill)` and are non-empty; `boundaries.md` exists
17
27
  with Not covering and Never claim non-empty; if `needs/` exists, ≥3 `N-`
@@ -20,7 +30,14 @@
20
30
  Fail → hand back to **easysociable-content** / refuse create; list missing
21
31
  files. User must say **强制继续** / **force continue** to call Gateway.
22
32
  No new Gateway or MCP params.
23
- 7. Call `create_run` / `slideshows create` through Gateway.
24
- 8. Save `runId`, `studioUrl`, and `status=draft`.
25
- 9. Do not call a Deck API, create a carousel template, or send a product
26
- `pageSequence` / `arc` field.
33
+ 7b. **Identity chain (ADR-0036):** confirm CLI auth is the user's Dashboard
34
+ Workspace API key (not `workspace_local` / `test-key`). If needed:
35
+ Studio login → Dashboard create key →
36
+ `easysociable auth login --api-key <key>`. Refuse create on fixture
37
+ identity unless the user asked for `--allow-local-fixture`.
38
+ 8. Call `create_run` / `slideshows create` through Gateway with the explicit
39
+ template ids from the pack.
40
+ 9. Save `runId`, `studioUrl`, and `status=draft`. Tell the user to open
41
+ `studioUrl` **while logged into the same Studio account**.
42
+ 10. Do not call a Deck API, create a carousel template, or send a product
43
+ `pageSequence` / `arc` field.