@lark-apaas/coding-steering 0.1.38 → 0.1.39-alpha.20260824122813
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 +6 -6
- package/steering/design-html/skills/pptx-style-extract/SKILL.md +19 -28
- package/steering/design-html/skills/pptx-style-extract/scripts/census.py +2 -8
- package/steering/design-html/skills/pptx-style-extract/scripts/draft.py +190 -1181
- package/steering/design-html/skills/pptx-style-extract/scripts/extract.py +10 -229
- package/steering/design-html/skills/pptx-style-extract/scripts/ooxml.py +1 -18
- package/steering/design-html/skills/pptx-style-extract/scripts/package.py +40 -643
- package/steering/design-html/skills/pptx-style-extract/scripts/parts.py +3 -19
- package/steering/design-html/skills/pptx-style-extract/scripts/render_pages.py +2 -4
- package/steering/design-html/skills/pptx-style-extract/scripts/test_background_composite.py +1 -308
- package/steering/design-html/skills/pptx-style-extract/scripts/test_design_consumer_contract.py +0 -14
- package/steering/design-html/skills/pptx-style-extract/scripts/test_flow_layout_contract.py +7 -157
- package/steering/design-html/skills/pptx-style-extract/scripts/test_layout_css.py +2 -1598
- package/steering/design-html/skills/pptx-style-extract/scripts/test_text_role_contract.py +4 -151
- package/steering/design-html/skills/pptx-style-extract/v2-format-spec.md +1 -1
- package/steering/design-html/skills/preflight/scripts/probe.sh +0 -0
- package/steering/nestjs-react-fullstack/skills/coding-guide/SKILL.md +0 -11
- package/steering/nestjs-react-fullstack/skills/contacts-service/SKILL.md +4 -67
- package/steering/nestjs-react-fullstack/skills/nestjs-cache/SKILL.md +1 -0
- package/steering/nestjs-react-fullstack/skills/openapi-guide/SKILL.md +0 -75
- package/steering/nestjs-react-fullstack/skills_local/coding-guide/SKILL.md +7 -5
- package/steering/design-html/skills/pptx-style-extract/scripts/test_asset_judgment_package.py +0 -556
- package/steering/design-html/skills/pptx-style-extract/scripts/test_logo_scope.py +0 -479
- package/steering/design-html/skills/pptx-style-extract/scripts/verify_layout_assets.py +0 -400
- package/steering/design-html/skills/pptx-style-extract/scripts/verify_logo_scope.py +0 -12
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/coding-steering",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.39-alpha.20260824122813",
|
|
4
4
|
"description": "Stack-specific steering content for miaoda-coding templates",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"steering"
|
|
8
8
|
],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"lint:md": "markdownlint 'steering/**/*.md' --ignore 'steering/**/skills/**' --ignore 'steering/**/skills_common/**' --ignore 'steering/**/skills_local/**'"
|
|
11
|
+
},
|
|
9
12
|
"devDependencies": {
|
|
10
13
|
"markdownlint-cli": "^0.47.0"
|
|
11
14
|
},
|
|
@@ -17,8 +20,5 @@
|
|
|
17
20
|
"miaoda",
|
|
18
21
|
"coding-steering"
|
|
19
22
|
],
|
|
20
|
-
"license": "MIT"
|
|
21
|
-
|
|
22
|
-
"lint:md": "markdownlint 'steering/**/*.md' --ignore 'steering/**/skills/**' --ignore 'steering/**/skills_common/**' --ignore 'steering/**/skills_local/**'"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
23
|
+
"license": "MIT"
|
|
24
|
+
}
|
|
@@ -65,37 +65,35 @@ mkdir -p tmp/pptx-style-extract/<unique-id> && PYTHONDONTWRITEBYTECODE=1 python3
|
|
|
65
65
|
|
|
66
66
|
**目录里没有 `.pptx` / `.potx`**(只有 `skills/` 之类)说明这次上传没有落成沙箱本地文件,本 skill 无法执行:如实告诉用户模板文件在沙箱里取不到、请重新上传或反馈平台,然后停下。此时**不要**用 `summarize_attachment_or_file` 的文本摘要当风格来源,也不要用 `generate_image` 自造配图充当模板视觉——那样产出的 deck 与模板无关,却看起来像成功了。
|
|
67
67
|
|
|
68
|
-
一条命令出全部:`extract.json`(普查数值)、`media-out/`(候选图)、`ref/`(审计层)、`l-out
|
|
68
|
+
一条命令出全部:`extract.json`(普查数值)、`media-out/`(候选图)、`ref/`(审计层)、`l-out/`(**四件判断单草案 + BRIEF.md + contact-sheet.png + layout-sheet.png**)。
|
|
69
69
|
|
|
70
70
|
非 OOXML / 损坏 / 加密 → 报告调用方,不产半成品。
|
|
71
71
|
|
|
72
72
|
## 2. 判断
|
|
73
73
|
|
|
74
|
-
1. 读 `<outdir>/l-out/BRIEF.md`
|
|
75
|
-
2.
|
|
76
|
-
3.
|
|
77
|
-
4.
|
|
78
|
-
5. 用一次 `multi_edit` 批量完成其余 TODO:风格气质,以及 `layout-controls.yaml` 中的页型/文本角色、布局模式和背景规则。普通文本槽默认 `body`,只把确实属于 `title|subtitle|header|footer` 的例外写进 `text_roles`;有 flow 与 slots 两种形态时默认保留 slots,只有样张明确需要内容随高度重排才填 `layout_modes: <页型>: flow`。不补不存在的标题、页眉或页脚。直接编辑草案,不写脚本改 YAML,也不修改 Skill 源码。
|
|
79
|
-
6. `layout-controls.yaml` 的 `bg_rules:` 按**背景资产**分组(不是按页型),只编辑草案已有且被页型 `background:` 引用的真实图片背景;没有 `bg_rules` 就不要新增。纯色、渐变、外框、几何装饰和透明叠层不是这里的背景资产。逐张背景填 `text_safe` / `avoid` / `pairing_rule`:看图标清视觉主体、强光斑、深色透明区,打包时自动并入用该背景的所有页型。标题、正文、关键数字、图表、卡片、时间线及其容器的外接矩形都不得压住背景主体,透明容器也不能跨进禁放区。
|
|
74
|
+
1. 读 `<outdir>/l-out/BRIEF.md` —— 事实、草案依据、待判断清单一页看完。清单是实时扫出来的,**只列真正还有 TODO 的文件**,没列到的那份不用打开。
|
|
75
|
+
2. 看 `<outdir>/l-out/contact-sheet.png` 与 `<outdir>/l-out/layout-sheet.png` —— 候选图和代表页型都已拼好,对应 BRIEF 的表。
|
|
76
|
+
3. 用 `multi_edit` 一次批量改掉四件草案里的每一处 `TODO`:风格命名与气质、页型角色、`text_roles` 里的文本角色、`layout_modes` 里的布局模式、以及下面第 4 条的禁放区。文本角色只按模板中实际存在的文字判断为 `title|subtitle|header|footer|body`;判断不清就填 `body`,不补模板里没有的标题、页眉或页脚。草案就在项目内相对路径下,直接编辑,**不要写脚本去改 YAML**。看过重建图后真有这套模板特有的硬规则(例如主色只许用在哪类元素)再往 `## Hard Rules` 补一条;没有就不补,别为凑数编规则。
|
|
77
|
+
4. `layouts.yaml` 顶部 `bg_rules:` 按**背景资产**分组(不是按页型),逐张背景填 `text_safe` / `avoid` / `pairing_rule`:看图标清视觉主体、强光斑、深色透明区,打包时自动并入用该背景的所有页型。标题、正文、关键数字、图表、卡片、时间线及其容器的外接矩形都不得压住背景主体,透明容器也不能跨进禁放区。
|
|
80
78
|
|
|
81
|
-
`
|
|
79
|
+
`layouts.yaml` 的 `layouts:` 段是普查数值——页型、坐标、字号、色值、对齐、以及各页型自带的 `role: logo` 资产槽全部直读,**一个字都不要动**。模板自己给版式起过名时 `names:` 已经填好,读一遍确认表意即可。
|
|
82
80
|
|
|
83
81
|
判断口径:
|
|
84
82
|
|
|
85
|
-
-
|
|
86
|
-
- **logo
|
|
83
|
+
- **满屏图默认属背景族**——整幅替换底图的艺术图/摄影图就是背景(首页那张记 `role: cover`);「内容图不进包」只指内容区里的图表、截图、配图。
|
|
84
|
+
- **logo 宁缺勿错**——看图确认有品牌文字或标志图形才留;拿不准就把该条从 `manifest.yaml` 删掉,在 `gaps` 写一句,候选图留在 `media-out/`。
|
|
87
85
|
- **anchors 是事实不是结论**——草案里每条只报测到的数(覆盖率、计数、占比),没有「这套风格的特征是 X」这种断言。这一段在 design.md 里读起来像总纲,消费端会照它建全局样式,所以脚本不敢替你下结论:一条 1/8 覆盖率的元素被描述成「跨页不动」,消费端就会每页都摆它。看过重建图后,把真正是这套模板特征的那几条改写成设计要点,不是特征的直接删掉。
|
|
88
86
|
- **数值只改名不改值**——草案里的坐标/色值/字号来自普查;确需推导值(CJK 行高转译、投影尺度上抬)在 manifest 写 `derived:` 声明理由,机检认声明。
|
|
89
|
-
- **页型命名**——模板自带版式名时草案已填好;只有靠样张聚类的模板(`
|
|
90
|
-
- **页型角色**——`
|
|
91
|
-
- **文本角色**——`
|
|
92
|
-
- **资产位置不要写成全局规则**——同一个 logo 常按页型换位换尺寸(封面一个位置一个尺寸、内容页另一个)。位置只存在于 `layouts.md` 各页型的 `slots`,正文里只说「按该页型的 slot
|
|
93
|
-
- **背景和版式要配对**——真实背景不是纯色底。看 `
|
|
87
|
+
- **页型命名**——模板自带版式名时草案已填好;只有靠样张聚类的模板(`names` 里还是 TODO)才需要按 BRIEF 的 slot 原文起中文名。
|
|
88
|
+
- **页型角色**——`roles:` 段有 TODO 时,看 `layout-sheet.png` 上对应的代表页定 `cover|section|content|quote|closing|blank|custom`。草案只把客观事实摆在注释里(代表页页码、页数、文字块数、字号序列、图片数、有无满屏底图),不替你下结论:字号多大算章节页、文字块多少算密集页,每套模板的答案都不一样。
|
|
89
|
+
- **文本角色**——`text_roles:` 段有 TODO 时,结合重建图和该行给出的来源、占位符、样例文字、box、字号与 CSS 判断标题、副标题、页眉、页脚或正文。这里仅改变已有文本槽的语义;所有文本槽、图片、容器与装饰仍由 `layouts:` 保留。标题、页眉或页脚已在背景中可见时,在 Hard Rules 写明对应页型只渲染已有 slots,不重复叠加文字。
|
|
90
|
+
- **资产位置不要写成全局规则**——同一个 logo 常按页型换位换尺寸(封面一个位置一个尺寸、内容页另一个)。位置只存在于 `layouts.md` 各页型的 `slots`,正文里只说「按该页型的 slot 摆放,没有就不放」。
|
|
91
|
+
- **背景和版式要配对**——真实背景不是纯色底。看 `contact-sheet.png` 判断每张背景的视觉主体/禁放区,看 `layout-sheet.png` 判断文字与卡片落点;`background` 草案已按版式直读填好,你只需在 `bg_rules` 里逐张背景补 `text_safe`、`avoid`、`pairing_rule`,避免消费 Agent 把文字、图表、卡片、时间线、标题容器、正文容器或宽透明容器的外接矩形压到金字塔、人物、产品图、强光斑或深色区域上。
|
|
94
92
|
- 双主题只认 BRIEF 的 `themes`;单主题包不写 `theme` 字段。
|
|
95
93
|
|
|
96
94
|
判断单里的**结构事实**(每个页型上方的注释)是判「这页该用绝对坐标还是流式」的依据:栅格几列、垂直间距序列(突变处即区带边界)、样张里每个文字槽的实际字数、命中哪个容器样式配方。文件头另有容器样式配方清单,带出现次数与跨页数——跨页多的是共性风格,只在一处出现的多半不是。
|
|
97
95
|
|
|
98
|
-
**页型给 `flow` 还是 `slots`,由你定**:内容长度会变的内容页(列表、表格、卡片组)优先用 `flow`,区带依次排,高度由实际内容决定;构图固定的页(封面、章节页)用 `slots`
|
|
96
|
+
**页型给 `flow` 还是 `slots`,由你定**:内容长度会变的内容页(列表、表格、卡片组)优先用 `flow`,区带依次排,高度由实际内容决定;构图固定的页(封面、章节页)用 `slots` 绝对坐标。在扁平 `layout_modes:` 段为每个候选页型填 `flow` 或 `slots`,打包时按它落一份。判据就在该页型上方的结构事实里:规整多列栅格、等距重复的间距、成对出现的长文本槽都指向 `flow`。`flow` 中并列卡片以 `grid` 表达,每张卡片的容器、标题和正文放在同一个一层 `role: group` 中;logo、页码、页眉和页脚等固定锚点留在带 `box` 的 `free` 区带。模型结合实际内容判断纵向间距与留白,不机械照搬样张的 `y` 坐标。
|
|
99
97
|
|
|
100
98
|
普查是有损的。判断不了时可以直接翻 `<outdir>/ref/source/` —— PPTX 解压后的原文都在那里(`ppt/slides/slideN.xml`、`ppt/slideLayouts/`、`ppt/theme/`)。它只在中间产物里,不进交付包。
|
|
101
99
|
|
|
@@ -107,9 +105,9 @@ mkdir -p tmp/pptx-style-extract/<unique-id> && PYTHONDONTWRITEBYTECODE=1 python3
|
|
|
107
105
|
PYTHONDONTWRITEBYTECODE=1 python3 -B scripts/package.py <outdir> <outdir>/l-out <包输出目录> --force
|
|
108
106
|
```
|
|
109
107
|
|
|
110
|
-
|
|
108
|
+
exit 0 即交付。FAIL 会指名道姓(TODO 未改 / 数值不可追溯 / 枚举误用 / 引用断链 / 体量超标),改判断单后**用同一个包目录重跑**(`--force` 就是为回修准备的),不要去改产物;体量 FAIL 走降级链(审计出包 → sidecar 化 → archetype 收缩)。
|
|
111
109
|
|
|
112
|
-
|
|
110
|
+
跑之前先确认判断单里 `TODO` 已经全部改完(`grep -rn TODO <outdir>/l-out`)——`body.md` 最容易漏。改完直接跑 package.py,不用先 `ls` 确认目录。
|
|
113
111
|
|
|
114
112
|
## 完成判据
|
|
115
113
|
|
|
@@ -130,20 +128,13 @@ Read `<pack_dir>/design.md` first, especially `## Usage`, `## Hard Rules`, color
|
|
|
130
128
|
When generating a deck:
|
|
131
129
|
|
|
132
130
|
1. Call `copy_starter_component` with `kind: "deck-stage.js"`.
|
|
133
|
-
2. Build `<deck-stage width="<canvas width>" height="<canvas height>">` using the `canvas` declared in `layouts.md` — source decks are not always 16:9, and a default-sized stage shifts every coordinate on the page. Each slide is one static `<section
|
|
131
|
+
2. Build `<deck-stage width="<canvas width>" height="<canvas height>">` using the `canvas` declared in `layouts.md` — source decks are not always 16:9, and a default-sized stage shifts every coordinate on the page. Each slide is one static `<section>`.
|
|
134
132
|
3. Inline CSS variables from `design.md` into the HTML `<style>` block using a `--ppt-*` prefix.
|
|
135
133
|
4. **位移动画用独立的 `translate` 属性**:`@keyframes fadeUp { from{opacity:0; translate:0 24px} to{opacity:1; translate:0 0} }`。`transform` 是单一属性,动画里碰它会覆盖掉元素原有的那条(`left:50%; transform:translateX(-50%)` 的居中就此丢失);`translate` / `rotate` / `scale` 各自独立,与已有 `transform` 叠加。
|
|
136
|
-
5. Map `layouts.md` slots to absolute-positioned elements inside each section: expand `box: [x,y,w,h]` mechanically to `left/top/width/height`, then apply the slot's `css` declaration string unchanged. `box` owns geometry; `css` owns all rendering style, including the template's text padding, typography, alignment, line height, letter spacing, and rotation. Do not reinterpret PPTX fields or replace slot CSS with your own type scale. A slot with `asset` is a fixed image element:
|
|
134
|
+
5. Map `layouts.md` slots to absolute-positioned elements inside each section: expand `box: [x,y,w,h]` mechanically to `left/top/width/height`, then apply the slot's `css` declaration string unchanged. `box` owns geometry; `css` owns all rendering style, including the template's text padding, typography, alignment, line height, letter spacing, and rotation. Do not reinterpret PPTX fields or replace slot CSS with your own type scale. A slot with `asset` is a fixed image element (logo, mark): place that asset at that box on that archetype only. Do not reflow any of this as generic web grids.
|
|
137
135
|
6. Copy `<pack_dir>/assets/` into the project, for example `assets/pptx-style/<pack-name>/`, and reference those copied files with relative URLs. The scratch `tmp/pptx-style-extract/...` path must never appear in the final HTML.
|
|
138
136
|
7. Use the font stacks and fallback rules from `design.md`; do not install fonts or dependencies at runtime.
|
|
139
|
-
8.
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
PYTHONDONTWRITEBYTECODE=1 python3 -B scripts/verify_layout_assets.py <pack_dir> <index.html> --asset-prefix <copied-assets-prefix>
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
`PPTX_LAYOUT_ASSETS: FAIL` means fix every reported instance according to `layouts.md`, then rerun the same command. Do not deliver or call `run_commit` until it prints `PPTX_LAYOUT_ASSETS: PASS`.
|
|
146
|
-
9. Run the slide preflight checks: no resource failures, no section overflow, and sampled screenshots follow the package colors, typography, layouts, assets, and Hard Rules.
|
|
137
|
+
8. Run the slide preflight checks: no resource failures, no section overflow, and sampled screenshots follow the package colors, typography, layouts, assets, and Hard Rules.
|
|
147
138
|
|
|
148
139
|
## Export Consumer Attachments
|
|
149
140
|
|
|
@@ -66,7 +66,6 @@ def image_census(shape_recs, bg_images, units):
|
|
|
66
66
|
'crop': r.get('crop'), 'placement': r.get('placement'),
|
|
67
67
|
'w_pct': r.get('w_pct'), 'h_pct': r.get('h_pct'),
|
|
68
68
|
'in_group': bool(r.get('group_path')), 'svg': r.get('media_svg'),
|
|
69
|
-
'visible_instance_blocked': r.get('visible_instance_blocked'),
|
|
70
69
|
})
|
|
71
70
|
for r in shape_recs:
|
|
72
71
|
f = r.get('fill') or {}
|
|
@@ -125,8 +124,6 @@ def image_census(shape_recs, bg_images, units):
|
|
|
125
124
|
'crop_variants': sorted(crop_sigs),
|
|
126
125
|
'stitch_candidate': len(crop_sigs) > 1,
|
|
127
126
|
'svg_companion': next((o.get('svg') for o in occs if o.get('svg')), None),
|
|
128
|
-
'visible_instance_blocked': any(
|
|
129
|
-
o.get('visible_instance_blocked') for o in occs),
|
|
130
127
|
})
|
|
131
128
|
images.sort(key=lambda i: (-i['n'], i['media']))
|
|
132
129
|
|
|
@@ -609,8 +606,6 @@ def layout_inventory(pkg, graph, shapes, bg_by_part):
|
|
|
609
606
|
for lp in pkg.layouts:
|
|
610
607
|
root = pkg.xml(lp)
|
|
611
608
|
cSld = root.find('p:cSld', NS)
|
|
612
|
-
master = graph['master_of_layout'].get(lp)
|
|
613
|
-
background = bg_by_part.get(lp) or bg_by_part.get(master)
|
|
614
609
|
phs = Counter()
|
|
615
610
|
for r in shapes:
|
|
616
611
|
if r['part'] == lp and r.get('ph'):
|
|
@@ -619,12 +614,11 @@ def layout_inventory(pkg, graph, shapes, bg_by_part):
|
|
|
619
614
|
'part': lp,
|
|
620
615
|
'name': cSld.get('name') if cSld is not None else None,
|
|
621
616
|
'type_attr': root.get('type', 'cust'),
|
|
622
|
-
'master':
|
|
617
|
+
'master': graph['master_of_layout'].get(lp),
|
|
623
618
|
'used_by_slides': graph['slides_per_layout'].get(lp, 0),
|
|
624
619
|
'placeholders': dict(phs),
|
|
625
620
|
'shape_n': sum(1 for r in shapes if r['part'] == lp),
|
|
626
|
-
'background':
|
|
627
|
-
'background_source': lp if bg_by_part.get(lp) else master,
|
|
621
|
+
'background': bg_by_part.get(lp),
|
|
628
622
|
'ph_signature': _ph_signature(shapes, lp),
|
|
629
623
|
'guides': [],
|
|
630
624
|
})
|