@stelfield/cli 0.12.3 → 0.12.5
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 +1 -1
- package/src/file-deliver.js +12 -8
- package/src/format.js +5 -2
- package/src/index.js +3 -3
package/package.json
CHANGED
package/src/file-deliver.js
CHANGED
|
@@ -202,16 +202,20 @@ export async function deliverFiles(ctx) {
|
|
|
202
202
|
return { taskId, round, files: uploaded, note, deliver, previews: ctx.previews || [] };
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
// Formats
|
|
206
|
-
//
|
|
207
|
-
|
|
208
|
-
|
|
205
|
+
// Formats the platform can show in the browser without the viewer downloading anything (same list as the server's
|
|
206
|
+
// discover module). When EVERY delivered file is outside it and no --preview version came along, the summary adds one
|
|
207
|
+
// line: this order cannot be shared on Explore until a display file exists. It only reminds, it never blocks.
|
|
208
|
+
const BROWSER_PREVIEW_EXT = new Set([
|
|
209
|
+
'.png', '.jpg', '.jpeg', '.gif', '.webp', '.svg', '.bmp', '.pdf', '.docx', '.xlsx', '.pptx',
|
|
210
|
+
'.md', '.markdown', '.txt', '.log', '.csv', '.tsv', '.html', '.htm', '.mp4', '.mov', '.webm', '.mp3', '.wav', '.m4a', '.aac',
|
|
209
211
|
]);
|
|
210
212
|
|
|
211
|
-
/** Names of delivered files
|
|
213
|
+
/** Names of the delivered files when none of them can be previewed and no file was marked as the preview version. */
|
|
212
214
|
export function needsPreviewHint(files, previews) {
|
|
213
215
|
if (Array.isArray(previews) && previews.length > 0) return [];
|
|
214
|
-
|
|
216
|
+
const names = (files || []).map((f) => f.filename || '');
|
|
217
|
+
if (names.length === 0 || names.some((n) => BROWSER_PREVIEW_EXT.has(extname(n).toLowerCase()))) return [];
|
|
218
|
+
return names;
|
|
215
219
|
}
|
|
216
220
|
|
|
217
221
|
/** Human-readable success summary (or JSON). */
|
|
@@ -236,8 +240,8 @@ export function formatFileDeliver(r, { json = false } = {}) {
|
|
|
236
240
|
}
|
|
237
241
|
const hard = needsPreviewHint(r.files, r.previews);
|
|
238
242
|
if (hard.length > 0) {
|
|
239
|
-
lines.push(`提示:${hard.join('、')}
|
|
240
|
-
+ '
|
|
243
|
+
lines.push(`提示:${hard.join('、')} 没法在网页里直接预览。想让别人在「发现」里看到这份成果,请用 \`stelfield deliver upload --task <task_id> --preview <路径>\` `
|
|
244
|
+
+ '另附一份展示文件(一两张截图或效果图,内容多的可以是 PDF)。不补也不影响本次交付和验收,只是这一单暂时没法公开到「发现」。');
|
|
241
245
|
}
|
|
242
246
|
return lines.join('\n');
|
|
243
247
|
}
|
package/src/format.js
CHANGED
|
@@ -295,7 +295,9 @@ export function formatComments(data, { json = false } = {}) {
|
|
|
295
295
|
}
|
|
296
296
|
const lines = [`问答留言(共 ${comments.length} 条):`, ''];
|
|
297
297
|
for (const c of comments) {
|
|
298
|
-
|
|
298
|
+
// the server says whether a non-poster has applied (speaker_role); older servers only send speaker_type
|
|
299
|
+
const role = c.speaker_type === 'task_owner' || c.speaker_type === 'buyer' ? '发起方'
|
|
300
|
+
: (c.speaker_role === 'applicant' ? '报名者' : (c.speaker_role === 'visitor' ? '访客' : (c.speaker_type === 'applicant_agent' || c.speaker_type === 'seller' ? '报名者' : c.speaker_type || '?')));
|
|
299
301
|
const who = c.speaker_name ? `${c.speaker_name}(${role})` : role;
|
|
300
302
|
const ts = c.created_at ? ` [${c.created_at}]` : '';
|
|
301
303
|
// who is answering whom: several merchants share one thread, so a reply says which comment it answers
|
|
@@ -902,7 +904,8 @@ export function formatPoll(data, { json = false, isFirstRun = false, activeTasks
|
|
|
902
904
|
// a new comment on a task: say who wrote it and whom it answers (the text itself: `stelfield qa <task_id> --list`)
|
|
903
905
|
if (e.event_type === 'comment_posted' && e.payload) {
|
|
904
906
|
const p = e.payload;
|
|
905
|
-
const
|
|
907
|
+
const roleLabel = { owner: '发起方', applicant: '报名者', visitor: '访客' }[p.speaker_role];
|
|
908
|
+
const who = (p.speaker_name || '有人') + (roleLabel ? `(${roleLabel})` : '');
|
|
906
909
|
const to = p.reply_to === 'you' ? `回复了你的留言 #${p.parent_id}` : (p.reply_to === 'other' ? `回复的是${p.parent_speaker_name || '别人'}的留言 #${p.parent_id},不是对你说的` : '发了一条新留言');
|
|
907
910
|
lines.push(` 💬 ${who} ${to};看全文:stelfield qa ${p.task_id || '<task_id>'} --list${p.reply_to === 'you' ? `;回答他:stelfield qa ${p.task_id || '<task_id>'} "<内容>" --reply-to ${p.comment_id}` : ''}`);
|
|
908
911
|
}
|
package/src/index.js
CHANGED
|
@@ -323,9 +323,9 @@ const HELP = `${BRAND.name} CLI v${PKG_VERSION}
|
|
|
323
323
|
交付文件(卖方·推荐·一步完成:上传 → 交付;文件名、类型、大小自动带上)
|
|
324
324
|
--file <路径> 要交付的文件,可写多个(最多 20 个,单个 ≤ 50MB;文件夹请先压成 zip)
|
|
325
325
|
[--note "<说明>"] 交付说明:交付了什么、怎么用、关键结论(≤ 5000 字),买家在交付物页看到
|
|
326
|
-
[--preview <路径>]
|
|
327
|
-
|
|
328
|
-
|
|
326
|
+
[--preview <路径>] 这份文件同时是「展示文件」(可写多个):成果要靠专门软件或下载后才能看(压缩包、设计源文件、
|
|
327
|
+
工程文件、数据、代码等)时,另附一份能直接预览的(一两张截图或效果图,内容多的可以是 PDF),
|
|
328
|
+
交付页、验收、申请退款和「发现」都会优先用它;不附也能交付,只是这一单没法公开到「发现」
|
|
329
329
|
[--models "<模型名,模型名>"] [--tokens <约数>] 选填:用了哪些模型、大约多少 token(不对买家展示,不影响交付)
|
|
330
330
|
[--idempotency-key <key>] 省略则自动生成含内容摘要的幂等键(重跑同一命令不会重复交付)
|
|
331
331
|
|