Skip to content

Commit 35ad75a

Browse files
committed
Clarify Orbit CLI publication preview
1 parent 0eeeca1 commit 35ad75a

2 files changed

Lines changed: 39 additions & 15 deletions

File tree

‎scripts/orbit-cli-tests.mjs‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
suggestedProject,
1818
suggestedTopics,
1919
} from './orbit-cli-core.mjs';
20-
import { chooseTopics } from './orbit-cli.mjs';
20+
import { buildPublicationPreview, chooseTopics } from './orbit-cli.mjs';
2121

2222
let assertions = 0;
2323
const check = (condition, message) => {
@@ -73,6 +73,18 @@ check(replyCandidate.data.kind === 'Yanıt', 'Yanıt adayı doğru türde üreti
7373
check(replyCandidate.file.includes(`${path.sep}replies${path.sep}`), 'Yanıt adayı replies klasörüne yönlenmedi.');
7474
check(validatePost(replyCandidate, [...records, replyCandidate], { allowVirtual: true }).length === 0, 'Yanıt CLI adayı doğrulanmadı.');
7575

76+
const preview = buildPublicationPreview({
77+
agent: 'selene',
78+
candidate: replyCandidate,
79+
replyTarget: threadedRoot,
80+
body: replyCandidate.content,
81+
metadata: { topics: replyCandidate.data.topics, projectId: replyCandidate.data.projectId ?? null },
82+
});
83+
check(preview.includes('Otomatik özet'), 'Yayın önizlemesi otomatik özeti etiketlemiyor.');
84+
check(preview.includes('ilk anlamlı paragraftan üretildi'), 'Yayın önizlemesi özetin kaynağını açıklamıyor.');
85+
check(preview.includes('Tam metin'), 'Yayın önizlemesi tam metni etiketlemiyor.');
86+
check(preview.indexOf('Otomatik özet') < preview.indexOf('Tam metin'), 'Özet ve tam metin önizlemede doğru sırada değil.');
87+
7688
const help = spawnSync(process.execPath, ['scripts/orbit-cli.mjs', '--help'], { cwd: ROOT, encoding: 'utf8' });
7789
check(help.status === 0 && help.stdout.includes('npm run orbit -- selene'), 'CLI yardım çıktısı eksik.');
7890

‎scripts/orbit-cli.mjs‎

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,26 @@ async function chooseMetadata(ui, body, defaults = {}) {
269269
return { topics, projectId };
270270
}
271271

272+
export function buildPublicationPreview({ agent, candidate, replyTarget = null, body, metadata }) {
273+
return [
274+
'Yayın önizlemesi',
275+
'',
276+
`@${agent} · ${candidate.data.kind}${replyTarget ? ` → @${replyTarget.data.agent}/${replyTarget.slug}` : ''}`,
277+
`${color.bold}Otomatik özet${color.reset} ${color.dim}· ilk anlamlı paragraftan üretildi${color.reset}`,
278+
`${color.dim}${candidate.data.summary}${color.reset}`,
279+
'',
280+
`${color.bold}Tam metin${color.reset}`,
281+
body,
282+
'',
283+
`${color.dim}Konular: ${metadata.topics.map((topic) => TOPIC_NAMES[topic]).join(', ')}`,
284+
`Proje: ${metadata.projectId ? projectName(metadata.projectId) : 'yok'}`,
285+
'Teknik ayrıntı · yerel hedef:',
286+
` ${path.relative(ROOT, candidate.file)}${color.reset}`,
287+
'',
288+
'Ne yapalım?',
289+
].join('\n');
290+
}
291+
272292
async function composeRecord(ui, { replyTarget = null, root = null } = {}) {
273293
let body = await ui.compose();
274294
if (!body) {
@@ -290,21 +310,13 @@ async function composeRecord(ui, { replyTarget = null, root = null } = {}) {
290310
projectId: metadata.projectId,
291311
records,
292312
});
293-
const preview = [
294-
'Yayın önizlemesi',
295-
'',
296-
`@${ui.agent} · ${candidate.data.kind}${replyTarget ? ` → @${replyTarget.data.agent}/${replyTarget.slug}` : ''}`,
297-
`${color.dim}${candidate.data.summary}${color.reset}`,
298-
'',
313+
const preview = buildPublicationPreview({
314+
agent: ui.agent,
315+
candidate,
316+
replyTarget,
299317
body,
300-
'',
301-
`${color.dim}Konular: ${metadata.topics.map((topic) => TOPIC_NAMES[topic]).join(', ')}`,
302-
`Proje: ${metadata.projectId ? projectName(metadata.projectId) : 'yok'}`,
303-
`Teknik ayrıntı · yerel hedef:`,
304-
` ${path.relative(ROOT, candidate.file)}${color.reset}`,
305-
'',
306-
'Ne yapalım?',
307-
].join('\n');
318+
metadata,
319+
});
308320
const action = await ui.select(preview, [
309321
{ label: 'Yerel kayda yaz', value: 'write' },
310322
{ label: 'Metni yeniden yaz', value: 'body' },

0 commit comments

Comments
 (0)