@lark-apaas/coding-miaoda-sandbox-skills 0.1.0-dev.b2f659e → 0.1.0-dev.c8cc2b5
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/miaoda/charts-skill/SKILL.md +1 -1
- package/miaoda/creative-to-fullstack/SKILL.md +105 -100
- package/miaoda/creative-to-fullstack/references/artifact-signals.md +2 -1
- package/miaoda/creative-to-fullstack/references/ui-to-function.md +5 -69
- package/miaoda/feishu/SKILL.md +4 -4
- package/miaoda/forms-skill/SKILL.md +9 -0
- package/miaoda/lark-apps-db/SKILL.md +3 -1
- package/miaoda/lark-apps-db/references/full-reference.md +13 -4
- package/miaoda/lark-apps-ops/SKILL.md +3 -2
- package/miaoda/lark-apps-ops/references/lark-apps-mcp.md +26 -0
- package/miaoda/lark-design-prototype/DESIGN.md +603 -0
- package/miaoda/lark-design-prototype/SKILL.md +85 -0
- package/miaoda/lark-design-prototype/references/assets/card-illustration-library.md +113 -0
- package/miaoda/lark-design-prototype/references/case-matching.md +53 -0
- package/miaoda/lark-design-prototype/references/cases/conversational-ai-home.md +27 -0
- package/miaoda/lark-design-prototype/references/cases/data-table.md +30 -0
- package/miaoda/lark-design-prototype/references/cases/official-home.md +26 -0
- package/miaoda/lark-design-prototype/references/cases/workspace-home.md +34 -0
- package/miaoda/lark-design-prototype/references/color-roles.md +163 -0
- package/miaoda/lark-design-prototype/references/component-selection.md +134 -0
- package/miaoda/lark-design-prototype/references/design-quality-checklist.md +156 -0
- package/miaoda/lark-design-prototype/references/form-shell-patterns.md +77 -0
- package/miaoda/lark-design-prototype/references/icon-semantics.md +237 -0
- package/miaoda/lark-design-prototype/references/layout-interaction.md +164 -0
- package/miaoda/lark-design-prototype/references/page-contract.md +281 -0
- package/miaoda/lark-design-prototype/references/product-patterns.md +93 -0
- package/miaoda/lark-design-prototype/references/prompt-expansion.md +107 -0
- package/miaoda/lark-design-prototype/references/restoration-traps.md +113 -0
- package/miaoda/lark-design-prototype/references/token-semantics.md +112 -0
- package/miaoda/lark-design-prototype/references/visual-brief.md +125 -0
- package/miaoda/lark-design-prototype/references/visual-style-prompts.md +61 -0
- package/miaoda/lark-design-prototype/scripts/icon-query.mjs +272 -0
- package/miaoda/lark-design-prototype/scripts/token-query.mjs +76 -0
- package/miaoda/lark-design-prototype/scripts/verify-static-html.mjs +117 -0
- package/miaoda/testing-guide/SKILL.md +106 -12
- package/miaoda-modern/charts-skill/SKILL.md +1 -1
- package/miaoda-modern/forms-skill/SKILL.md +33 -3
- package/miaoda-modern/lark-apps-ops/SKILL.md +3 -2
- package/miaoda-modern/lark-apps-ops/references/lark-apps-mcp.md +26 -0
- package/miaoda-modern/lark-design-prototype/DESIGN.md +603 -0
- package/miaoda-modern/lark-design-prototype/SKILL.md +85 -0
- package/miaoda-modern/lark-design-prototype/references/assets/card-illustration-library.md +113 -0
- package/miaoda-modern/lark-design-prototype/references/case-matching.md +53 -0
- package/miaoda-modern/lark-design-prototype/references/cases/conversational-ai-home.md +27 -0
- package/miaoda-modern/lark-design-prototype/references/cases/data-table.md +30 -0
- package/miaoda-modern/lark-design-prototype/references/cases/official-home.md +26 -0
- package/miaoda-modern/lark-design-prototype/references/cases/workspace-home.md +34 -0
- package/miaoda-modern/lark-design-prototype/references/color-roles.md +163 -0
- package/miaoda-modern/lark-design-prototype/references/component-selection.md +134 -0
- package/miaoda-modern/lark-design-prototype/references/design-quality-checklist.md +156 -0
- package/miaoda-modern/lark-design-prototype/references/form-shell-patterns.md +77 -0
- package/miaoda-modern/lark-design-prototype/references/icon-semantics.md +237 -0
- package/miaoda-modern/lark-design-prototype/references/layout-interaction.md +164 -0
- package/miaoda-modern/lark-design-prototype/references/page-contract.md +281 -0
- package/miaoda-modern/lark-design-prototype/references/product-patterns.md +93 -0
- package/miaoda-modern/lark-design-prototype/references/prompt-expansion.md +107 -0
- package/miaoda-modern/lark-design-prototype/references/restoration-traps.md +113 -0
- package/miaoda-modern/lark-design-prototype/references/token-semantics.md +112 -0
- package/miaoda-modern/lark-design-prototype/references/visual-brief.md +125 -0
- package/miaoda-modern/lark-design-prototype/references/visual-style-prompts.md +61 -0
- package/miaoda-modern/lark-design-prototype/scripts/icon-query.mjs +272 -0
- package/miaoda-modern/lark-design-prototype/scripts/token-query.mjs +76 -0
- package/miaoda-modern/lark-design-prototype/scripts/verify-static-html.mjs +117 -0
- package/miaoda-modern/reviewer-usage/SKILL.md +2 -0
- package/package.json +1 -1
- package/shared/attachment/SKILL.md +5 -1
- package/miaoda-modern/testing-guide/SKILL.md +0 -218
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
|
|
6
|
+
const SVG_BASE = 'https://cdn-tos-cn.bytedance.net/obj/archi/ee/es-design-base/svgs';
|
|
7
|
+
const REMOTE_CATALOG =
|
|
8
|
+
'https://lf3-static.bytednsdoc.com/obj/eden-cn/pshi/lark-design-prototype/1.0.4/db71a6cd-33f97519-0d446cd5/icons.catalog.json';
|
|
9
|
+
const REMOTE_CATALOG_SHA256 = 'db71a6cd6ac90c77629e8ce0fc0905ca1488a6601800ff7533385490b10eac9d';
|
|
10
|
+
|
|
11
|
+
function usage() {
|
|
12
|
+
return `Usage:
|
|
13
|
+
node icon-query.mjs [--catalog <remote|catalog.json|url>] --query "<keywords>" [--family outlined] [--style v2-outlined|source-outlined|source-filled|source-colorful] [--shape normal|round] [--prefer-v2] [--require-v2] [--limit 5]
|
|
14
|
+
|
|
15
|
+
Returns a compact JSON array with name, hash, family, version, shape, score, description, and final svgUrl.
|
|
16
|
+
Never print the raw icon catalog during page generation.`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function argValue(name, fallback = '') {
|
|
20
|
+
const index = process.argv.indexOf(name);
|
|
21
|
+
return index === -1 ? fallback : process.argv[index + 1] || fallback;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function argFlag(name) {
|
|
25
|
+
return process.argv.includes(name);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function tokenize(text) {
|
|
29
|
+
const rawTokens = String(text || '')
|
|
30
|
+
.toLowerCase()
|
|
31
|
+
.split(/[\s,,、::;;/|()()\[\]{}'"`<>.!??。_-]+/)
|
|
32
|
+
.map((item) => item.trim())
|
|
33
|
+
.filter(Boolean);
|
|
34
|
+
const aliases = {
|
|
35
|
+
搜索: ['search'],
|
|
36
|
+
查找: ['search'],
|
|
37
|
+
通知: ['notification', 'bell'],
|
|
38
|
+
提醒: ['reminder', 'bell'],
|
|
39
|
+
主页: ['home'],
|
|
40
|
+
首页: ['home'],
|
|
41
|
+
模板: ['template'],
|
|
42
|
+
文档: ['doc', 'document', 'file'],
|
|
43
|
+
document: ['doc'],
|
|
44
|
+
文件: ['file'],
|
|
45
|
+
文件夹: ['folder'],
|
|
46
|
+
表格: ['sheet', 'table', 'bitable'],
|
|
47
|
+
spreadsheet: ['sheet'],
|
|
48
|
+
table: ['sheet'],
|
|
49
|
+
图表: ['chart'],
|
|
50
|
+
看板: ['dashboard', 'chart'],
|
|
51
|
+
帮助: ['help', 'faq'],
|
|
52
|
+
指南: ['guide', 'info'],
|
|
53
|
+
飞书: ['feishu', 'lark', 'logo', 'logotype'],
|
|
54
|
+
品牌: ['brand', 'logo', 'logotype'],
|
|
55
|
+
标识: ['logo', 'logotype'],
|
|
56
|
+
logo: ['brand', 'logotype'],
|
|
57
|
+
};
|
|
58
|
+
const expanded = new Set(rawTokens);
|
|
59
|
+
for (const token of rawTokens) {
|
|
60
|
+
for (const alias of aliases[token] || []) {
|
|
61
|
+
expanded.add(alias);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return [...expanded];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function readJsonFile(filePath) {
|
|
68
|
+
const text = await fs.readFile(filePath, 'utf8');
|
|
69
|
+
return JSON.parse(text);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function readCatalog(source) {
|
|
73
|
+
const resolved = !source || source === 'remote' ? REMOTE_CATALOG : source;
|
|
74
|
+
if (/^https?:\/\//.test(resolved)) {
|
|
75
|
+
const response = await fetch(resolved);
|
|
76
|
+
if (!response.ok) {
|
|
77
|
+
throw new Error(`Catalog request failed with HTTP ${response.status}`);
|
|
78
|
+
}
|
|
79
|
+
const text = await response.text();
|
|
80
|
+
if (resolved === REMOTE_CATALOG) {
|
|
81
|
+
const actualHash = createHash('sha256').update(text).digest('hex');
|
|
82
|
+
if (actualHash !== REMOTE_CATALOG_SHA256) {
|
|
83
|
+
throw new Error(
|
|
84
|
+
`Catalog integrity check failed: expected ${REMOTE_CATALOG_SHA256}, got ${actualHash}`,
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return { catalog: JSON.parse(text), catalogSource: resolved };
|
|
89
|
+
}
|
|
90
|
+
const filePath = path.resolve(resolved);
|
|
91
|
+
return { catalog: await readJsonFile(filePath), catalogSource: filePath };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function detectVersion(name) {
|
|
95
|
+
return /(?:^|[-_])v2(?:[-_]|$)/i.test(name) ? 'v2' : 'non-v2';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function detectShape(icon) {
|
|
99
|
+
const name = icon.name.toLowerCase();
|
|
100
|
+
if (name.includes('file-round-') || name.includes('wiki-round-')) return 'round';
|
|
101
|
+
if (icon.family === 'colorful' && /(?:icon_|wiki-)?file[-_]/.test(name)) return 'normal';
|
|
102
|
+
return 'none';
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function detectStyleType(icon) {
|
|
106
|
+
const version = detectVersion(icon.name);
|
|
107
|
+
const shape = detectShape(icon);
|
|
108
|
+
if (icon.family === 'outlined') {
|
|
109
|
+
return version === 'v2' ? 'v2-outlined' : 'non-v2-outlined';
|
|
110
|
+
}
|
|
111
|
+
if (icon.family === 'filled') {
|
|
112
|
+
return 'source-filled';
|
|
113
|
+
}
|
|
114
|
+
if (icon.family === 'colorful' && /(?:feishu|lark).*logo|logotype|logo/i.test(icon.name)) {
|
|
115
|
+
return 'brand-colorful';
|
|
116
|
+
}
|
|
117
|
+
if (icon.family === 'colorful' && version === 'v2' && shape === 'round') {
|
|
118
|
+
return 'file-v2-colorful-round';
|
|
119
|
+
}
|
|
120
|
+
if (icon.family === 'colorful' && version === 'v2' && shape === 'normal') {
|
|
121
|
+
return 'file-v2-colorful-normal';
|
|
122
|
+
}
|
|
123
|
+
return icon.family;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function normalizeOptions() {
|
|
127
|
+
const style = argValue('--style');
|
|
128
|
+
const options = {
|
|
129
|
+
family: argValue('--family', 'outlined'),
|
|
130
|
+
style,
|
|
131
|
+
shape: argValue('--shape'),
|
|
132
|
+
preferV2: argFlag('--prefer-v2'),
|
|
133
|
+
requireV2: argFlag('--require-v2'),
|
|
134
|
+
requireNonV2: argFlag('--require-non-v2'),
|
|
135
|
+
include: argValue('--name-include'),
|
|
136
|
+
exclude: argValue('--name-exclude'),
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
if (style === 'v2-outlined') {
|
|
140
|
+
options.family = 'outlined';
|
|
141
|
+
options.requireV2 = true;
|
|
142
|
+
} else if (style === 'non-v2-outlined') {
|
|
143
|
+
options.family = 'outlined';
|
|
144
|
+
options.requireNonV2 = true;
|
|
145
|
+
} else if (style === 'file-v2-colorful-normal') {
|
|
146
|
+
options.family = 'colorful';
|
|
147
|
+
options.requireV2 = true;
|
|
148
|
+
options.shape = 'normal';
|
|
149
|
+
options.include ||= 'file';
|
|
150
|
+
} else if (style === 'file-v2-colorful-round') {
|
|
151
|
+
options.family = 'colorful';
|
|
152
|
+
options.requireV2 = true;
|
|
153
|
+
options.shape = 'round';
|
|
154
|
+
options.include ||= 'file-round';
|
|
155
|
+
} else if (style === 'source-outlined') {
|
|
156
|
+
options.family = 'outlined';
|
|
157
|
+
options.preferV2 = true;
|
|
158
|
+
} else if (style === 'source-filled') {
|
|
159
|
+
options.family = 'filled';
|
|
160
|
+
} else if (style === 'brand-colorful' || style === 'source-colorful') {
|
|
161
|
+
options.family = 'colorful';
|
|
162
|
+
if (style === 'source-colorful') {
|
|
163
|
+
options.preferV2 = true;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return options;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function flattenCatalog(catalog, options) {
|
|
170
|
+
const rows = [];
|
|
171
|
+
for (const category of catalog) {
|
|
172
|
+
for (const [family, icons] of Object.entries(category.icons || {})) {
|
|
173
|
+
if (options.family && family !== options.family) {
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
for (const icon of icons || []) {
|
|
177
|
+
const row = {
|
|
178
|
+
category: category.id || '',
|
|
179
|
+
family,
|
|
180
|
+
name: icon.name,
|
|
181
|
+
hash: icon.hash,
|
|
182
|
+
darkHash: icon.darkHash,
|
|
183
|
+
description: icon.description || '',
|
|
184
|
+
};
|
|
185
|
+
row.version = detectVersion(row.name);
|
|
186
|
+
row.shape = detectShape(row);
|
|
187
|
+
row.styleType = detectStyleType(row);
|
|
188
|
+
rows.push(row);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return rows;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function passesFilters(icon, options) {
|
|
196
|
+
const name = icon.name.toLowerCase();
|
|
197
|
+
if (options.requireV2 && icon.version !== 'v2') return false;
|
|
198
|
+
if (options.requireNonV2 && icon.version !== 'non-v2') return false;
|
|
199
|
+
if (options.shape && icon.shape !== options.shape) return false;
|
|
200
|
+
if (options.include && !name.includes(options.include.toLowerCase())) return false;
|
|
201
|
+
if (options.exclude && name.includes(options.exclude.toLowerCase())) return false;
|
|
202
|
+
const sourceStyles = new Set(['source-outlined', 'source-filled', 'source-colorful']);
|
|
203
|
+
if (options.style && !sourceStyles.has(options.style) && icon.styleType !== options.style)
|
|
204
|
+
return false;
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function scoreIcon(icon, queryTokens, options) {
|
|
209
|
+
const name = icon.name.toLowerCase();
|
|
210
|
+
const description = icon.description.toLowerCase();
|
|
211
|
+
let score = 0;
|
|
212
|
+
for (const token of queryTokens) {
|
|
213
|
+
if (name.includes(token)) score += 5;
|
|
214
|
+
if (description.includes(token)) score += 3;
|
|
215
|
+
if (name === `icon_${token}_outlined`) score += 8;
|
|
216
|
+
if (name === `icon_${token}-v2_outlined`) score += 8;
|
|
217
|
+
if (name === `icon_${token}_filled`) score += 8;
|
|
218
|
+
if (name === `icon_file-${token}-v2_colorful`) score += 8;
|
|
219
|
+
}
|
|
220
|
+
if (score === 0) return 0;
|
|
221
|
+
if (icon.family === 'outlined') score += 1;
|
|
222
|
+
if ((options.preferV2 || options.style?.includes('v2')) && icon.version === 'v2') score += 4;
|
|
223
|
+
if (
|
|
224
|
+
options.style === 'brand-colorful' &&
|
|
225
|
+
/feishu|lark|logotype|logo/i.test(`${name} ${description}`)
|
|
226
|
+
)
|
|
227
|
+
score += 10;
|
|
228
|
+
|
|
229
|
+
const objectTokens = ['doc', 'document', 'file', 'card', 'sheet', 'bitable', 'ai'];
|
|
230
|
+
const queryHasObject = objectTokens.some((token) => queryTokens.includes(token));
|
|
231
|
+
if (
|
|
232
|
+
!queryHasObject &&
|
|
233
|
+
objectTokens.some((token) => name.includes(`_${token}`) || name.includes(`-${token}`))
|
|
234
|
+
) {
|
|
235
|
+
score -= 3;
|
|
236
|
+
}
|
|
237
|
+
return score;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const catalogSource = argValue('--catalog', 'remote');
|
|
241
|
+
const query = argValue('--query');
|
|
242
|
+
const limit = Math.max(1, Number.parseInt(argValue('--limit', '5'), 10) || 5);
|
|
243
|
+
|
|
244
|
+
if (!query) {
|
|
245
|
+
console.error(usage());
|
|
246
|
+
process.exit(2);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const options = normalizeOptions();
|
|
250
|
+
const queryTokens = tokenize(query);
|
|
251
|
+
const { catalog, catalogSource: usedCatalogSource } = await readCatalog(catalogSource);
|
|
252
|
+
const matches = flattenCatalog(catalog, options)
|
|
253
|
+
.filter((icon) => passesFilters(icon, options))
|
|
254
|
+
.map((icon) => ({ ...icon, score: scoreIcon(icon, queryTokens, options) }))
|
|
255
|
+
.filter((icon) => icon.score > 0)
|
|
256
|
+
.sort((a, b) => b.score - a.score || a.name.localeCompare(b.name))
|
|
257
|
+
.slice(0, limit)
|
|
258
|
+
.map((icon) => ({
|
|
259
|
+
name: icon.name,
|
|
260
|
+
hash: icon.hash,
|
|
261
|
+
darkHash: icon.darkHash || undefined,
|
|
262
|
+
family: icon.family,
|
|
263
|
+
version: icon.version,
|
|
264
|
+
shape: icon.shape,
|
|
265
|
+
styleType: icon.styleType,
|
|
266
|
+
score: icon.score,
|
|
267
|
+
description: icon.description.slice(0, 180),
|
|
268
|
+
svgUrl: `${SVG_BASE}/${icon.name}.${icon.hash}.svg`,
|
|
269
|
+
catalogSource: usedCatalogSource,
|
|
270
|
+
}));
|
|
271
|
+
|
|
272
|
+
console.log(JSON.stringify(matches, null, 2));
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
|
|
4
|
+
const SOURCES = {
|
|
5
|
+
semantic: {
|
|
6
|
+
url: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/pshi/lark-design-prototype/1.0.4/db71a6cd-33f97519-0d446cd5/semantic.json',
|
|
7
|
+
sha256: '33f975193bcd0b5b12df9003e6f8586bf4662336e0bd5cf73ea1f362cfa4eb50',
|
|
8
|
+
},
|
|
9
|
+
keys: {
|
|
10
|
+
url: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/pshi/lark-design-prototype/1.0.4/db71a6cd-33f97519-0d446cd5/keys.json',
|
|
11
|
+
sha256: '0d446cd57b0beaaaa9ba485009b31a73be77d5f87a8481ec032c54f33b3bb471',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
function usage() {
|
|
16
|
+
return `Usage:
|
|
17
|
+
node token-query.mjs --query "<token name or intent>" [--source semantic|keys] [--limit 5]
|
|
18
|
+
|
|
19
|
+
Fetches the versioned public token resource, verifies SHA-256, and returns compact matches.`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function argValue(name, fallback = '') {
|
|
23
|
+
const index = process.argv.indexOf(name);
|
|
24
|
+
return index === -1 ? fallback : process.argv[index + 1] || fallback;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function tokenize(value) {
|
|
28
|
+
return String(value || '')
|
|
29
|
+
.toLowerCase()
|
|
30
|
+
.split(/[\s,,、::;;/|()()\[\]{}'"`<>.!??。_-]+/)
|
|
31
|
+
.map((item) => item.trim())
|
|
32
|
+
.filter(Boolean);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function scoreEntry([key, value], query, queryTokens) {
|
|
36
|
+
const normalizedKey = key.toLowerCase();
|
|
37
|
+
const searchText = `${key} ${value?.$description || ''} ${value?.$extensions?.id || ''} ${
|
|
38
|
+
value?.$extensions?.name || ''
|
|
39
|
+
}`.toLowerCase();
|
|
40
|
+
let score = normalizedKey === query ? 100 : normalizedKey.includes(query) ? 40 : 0;
|
|
41
|
+
for (const token of queryTokens) {
|
|
42
|
+
if (normalizedKey.includes(token)) score += 10;
|
|
43
|
+
if (searchText.includes(token)) score += 3;
|
|
44
|
+
}
|
|
45
|
+
return score;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const sourceName = argValue('--source', 'semantic');
|
|
49
|
+
const source = SOURCES[sourceName];
|
|
50
|
+
const query = argValue('--query').trim().toLowerCase();
|
|
51
|
+
const limit = Math.max(1, Number.parseInt(argValue('--limit', '5'), 10) || 5);
|
|
52
|
+
|
|
53
|
+
if (!source || !query) {
|
|
54
|
+
console.error(usage());
|
|
55
|
+
process.exit(2);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const response = await fetch(source.url);
|
|
59
|
+
if (!response.ok) {
|
|
60
|
+
throw new Error(`Token request failed with HTTP ${response.status}`);
|
|
61
|
+
}
|
|
62
|
+
const text = await response.text();
|
|
63
|
+
const actualHash = createHash('sha256').update(text).digest('hex');
|
|
64
|
+
if (actualHash !== source.sha256) {
|
|
65
|
+
throw new Error(`Token integrity check failed: expected ${source.sha256}, got ${actualHash}`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const queryTokens = tokenize(query);
|
|
69
|
+
const matches = Object.entries(JSON.parse(text))
|
|
70
|
+
.map((entry) => ({ entry, score: scoreEntry(entry, query, queryTokens) }))
|
|
71
|
+
.filter(({ score }) => score > 0)
|
|
72
|
+
.sort((a, b) => b.score - a.score || a.entry[0].localeCompare(b.entry[0]))
|
|
73
|
+
.slice(0, limit)
|
|
74
|
+
.map(({ entry: [key, value] }) => ({ key, ...value, source: source.url }));
|
|
75
|
+
|
|
76
|
+
console.log(JSON.stringify(matches, null, 2));
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { pathToFileURL } from 'node:url';
|
|
5
|
+
|
|
6
|
+
function usage() {
|
|
7
|
+
return `Usage:
|
|
8
|
+
node verify-static-html.mjs <file.html> [--sidebar]
|
|
9
|
+
|
|
10
|
+
Runs token-light pre-browser checks for Lark-style static HTML deliverables.
|
|
11
|
+
Use --sidebar only when the page contains a navigation sidebar. Shadow declarations are reported for contextual review.`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const htmlPath = process.argv[2];
|
|
15
|
+
if (!htmlPath) {
|
|
16
|
+
console.error(usage());
|
|
17
|
+
process.exit(2);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const absoluteHtmlPath = path.resolve(htmlPath);
|
|
21
|
+
const html = await fs.readFile(absoluteHtmlPath, 'utf8');
|
|
22
|
+
|
|
23
|
+
const hardFailures = [];
|
|
24
|
+
const warnings = [];
|
|
25
|
+
const passed = [];
|
|
26
|
+
|
|
27
|
+
function pass(name, ok, failMessage, warn = false) {
|
|
28
|
+
if (ok) {
|
|
29
|
+
passed.push(name);
|
|
30
|
+
} else if (warn) {
|
|
31
|
+
warnings.push(failMessage);
|
|
32
|
+
} else {
|
|
33
|
+
hardFailures.push(failMessage);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
pass(
|
|
38
|
+
'no gradients',
|
|
39
|
+
!/(linear-gradient|radial-gradient|conic-gradient)/i.test(html),
|
|
40
|
+
'Page UI contains gradients.',
|
|
41
|
+
);
|
|
42
|
+
const shadows = [...html.matchAll(/box-shadow\s*:\s*([^;}"'<>]+)/gi)]
|
|
43
|
+
.map((match) => match[1].trim())
|
|
44
|
+
.filter((value) => !/^none(?:\s*!important)?$/i.test(value));
|
|
45
|
+
pass(
|
|
46
|
+
'no shadows requiring contextual review',
|
|
47
|
+
shadows.length === 0,
|
|
48
|
+
'Shadow declarations found; verify they belong to permitted floating layers, not ordinary cards.',
|
|
49
|
+
true,
|
|
50
|
+
);
|
|
51
|
+
if (process.argv.includes('--sidebar')) {
|
|
52
|
+
pass(
|
|
53
|
+
'fixed sidebar background',
|
|
54
|
+
html.includes('#f9f9f9'),
|
|
55
|
+
'Sidebar background #f9f9f9 is missing.',
|
|
56
|
+
);
|
|
57
|
+
pass(
|
|
58
|
+
'fixed selected sidebar state',
|
|
59
|
+
html.includes('#1f23290d'),
|
|
60
|
+
'Selected sidebar state #1f23290d is missing.',
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
pass('has table', /<table[\s>]/i.test(html), 'No table found.', true);
|
|
64
|
+
pass('has search input', /type=["']search["']/i.test(html), 'No search input found.', true);
|
|
65
|
+
pass(
|
|
66
|
+
'has local responsive CSS',
|
|
67
|
+
/@media\s*\(/i.test(html),
|
|
68
|
+
'No responsive media query found.',
|
|
69
|
+
true,
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const imageRefs = [...html.matchAll(/<img\b[^>]*\bsrc=["']([^"']+)["']/gi)].map(
|
|
73
|
+
(match) => match[1],
|
|
74
|
+
);
|
|
75
|
+
const localImageRefs = imageRefs.filter(
|
|
76
|
+
(src) => !/^(https?:)?\/\//.test(src) && !src.startsWith('data:'),
|
|
77
|
+
);
|
|
78
|
+
const missingImages = [];
|
|
79
|
+
for (const src of localImageRefs) {
|
|
80
|
+
try {
|
|
81
|
+
await fs.access(new URL(src, pathToFileURL(absoluteHtmlPath)));
|
|
82
|
+
} catch {
|
|
83
|
+
missingImages.push(src);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
pass(
|
|
88
|
+
'all local images exist',
|
|
89
|
+
missingImages.length === 0,
|
|
90
|
+
`Missing local image assets: ${missingImages.join(', ')}`,
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
const tableHeaders = [...html.matchAll(/<th\b[^>]*>([\s\S]*?)<\/th>/gi)]
|
|
94
|
+
.map((match) => match[1].replace(/<[^>]+>/g, '').trim())
|
|
95
|
+
.filter(Boolean);
|
|
96
|
+
|
|
97
|
+
console.log(
|
|
98
|
+
JSON.stringify(
|
|
99
|
+
{
|
|
100
|
+
file: absoluteHtmlPath,
|
|
101
|
+
passed,
|
|
102
|
+
warnings,
|
|
103
|
+
hardFailures,
|
|
104
|
+
stats: {
|
|
105
|
+
images: imageRefs.length,
|
|
106
|
+
localImages: localImageRefs.length,
|
|
107
|
+
tableHeaders,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
null,
|
|
111
|
+
2,
|
|
112
|
+
),
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
if (hardFailures.length > 0) {
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
@@ -3,6 +3,7 @@ name: reviewer-usage
|
|
|
3
3
|
description: "Reviewer SubAgent dispatch & post-return protocol — required reading BEFORE invoking Reviewer. Covers when you MUST escalate to Reviewer after repeated self-fix failures, how many Reviewers to dispatch, how to split scopes, what the prompt must contain, and how to act on the per-issue policy tags Reviewer returns. 触发词:派 Reviewer、code review、审查、排查、review and fix、反复失败、修不好、repeated-fix"
|
|
4
4
|
available-agents:
|
|
5
5
|
- Code
|
|
6
|
+
- DesignModern
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
# Reviewer Usage Guide
|
|
@@ -92,6 +93,7 @@ No AskUser, no confirmation, no asking the user.
|
|
|
92
93
|
- **STEP 3a (echo)**: emit a short user-facing summary listing the `policy: AskUser` issues, grouped by 🔴 Critical / 🟠 Bug / 🟡 Suggestion, with file:line. ≤25 lines (collapse the rest as `... (其余 N 项见下方表单)`). The user cannot see Reviewer's report directly — without this echo they cannot decide.
|
|
93
94
|
- **STEP 3b (call ask_user_question)**: in the same turn, immediately call `ask_user_question` — `header`: `Review 确认`; `description`: paste the same list as STEP 3a; ONE Radio `question`: "Reviewer 另发现以下超出本次任务范围的问题,是否一并处理?"; use the exact `options` and `recommended` label that the ACTION header specified.
|
|
94
95
|
- No FINAL reply between 3a and 3b.
|
|
96
|
+
- **STEP 3b applies only if `ask_user_question` is in your tool list.** Some chains deliberately omit it (no confirmation step by design). If you do not have that tool: do STEP 3a only and stop there — this bucket degrades to report-only, and Step 4 does not apply. Do NOT seek confirmation by any other means (no free-text question, no other tool), and do NOT promote these issues to auto-fix. State plainly which issues were reported but not acted on; never present "not confirmed" as "no problem".
|
|
95
97
|
|
|
96
98
|
### Step 4 — Act on the user's choice
|
|
97
99
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/coding-miaoda-sandbox-skills",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.c8cc2b5",
|
|
4
4
|
"description": "Miaoda 合并沙箱 skills 包(包含原 miaoda-skills 的 miaoda / miaoda-modern / miaoda-design / shared 四条业务线);发布公网 npm,随沙箱运行时经 update-skills 同步到 .agent/skills/",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: attachment
|
|
3
|
-
description: "Use when user mentions attachments, uploaded files, or shared files.
|
|
3
|
+
description: "附件预处理 / Attachment Preprocessing. Use when user mentions attachments, uploaded files, or shared files. 当用户提到附件、上传文件或共享文件时使用;仅负责列出、解压和读取 .agent/{conversation_id}/attachments 下的文件,后续处理由文件内容和用户意图决定。"
|
|
4
|
+
metadata:
|
|
5
|
+
display-names:
|
|
6
|
+
zh-CN: 附件预处理
|
|
7
|
+
en-US: Attachment Preprocessing
|
|
4
8
|
---
|
|
5
9
|
|
|
6
10
|
# Attachment Preprocessing
|