@gobing-ai/knowledge-kit 0.1.15 → 0.1.17
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/.claude-plugin/marketplace.json +1 -1
- package/dist/index.js +1765 -40
- package/package.json +1 -1
- package/plugins/generations/content-gen/dist/index.js +58 -52
- package/plugins/generations/content-gen/src/storm.ts +94 -61
- package/plugins/generations/core-facts-gen/dist/index.js +1 -1
- package/plugins/generations/daily-article-gen/dist/index.js +1 -1
- package/plugins/generations/dailynews-gen/dist/index.js +1 -1
- package/plugins/generations/episode-plan-gen/dist/index.js +1 -1
- package/plugins/generations/gemini-tts/dist/index.js +1 -1
- package/plugins/generations/image-gen/README.md +31 -10
- package/plugins/generations/image-gen/assets/sample/cover__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-cover__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__clean-webapp-ui.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__cute.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__daily-news.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__editorial.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__fresh.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__minimalist.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__photorealistic.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__sketch.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__technical-diagram.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__vibrant.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__warm.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/daily-news-podcast-cover__xhs-knowledge.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/free__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/illustration__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/assets/sample/xhs-card__quasi-news-podcast.jpg +0 -0
- package/plugins/generations/image-gen/dist/index.js +1 -1
- package/plugins/generations/image-gen/presets/formats/daily-news-podcast-cover.yaml +18 -0
- package/plugins/generations/image-gen/presets/styles/quasi-news-podcast.yaml +9 -0
- package/plugins/generations/news-report-gen/dist/index.js +1 -1
- package/plugins/generations/voice-gen/dist/index.js +1 -1
- package/plugins/generations/voxcpm-tts/dist/index.js +1 -1
- package/plugins/ingestions/aihot-ingest/dist/index.js +1 -1
- package/plugins/ingestions/horizon-ingest/dist/index.js +1 -1
- package/plugins/ingestions/last30days-ingest/dist/index.js +1 -1
- package/plugins/ingestions/web-search/dist/index.js +1 -1
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/publish-presets/daily-ai-voice-migration.json +12 -3
- package/plugins/kk/publish-presets/daily-ai-voice.json +17 -9
- package/plugins/kk/publish-presets/itc-main.json +42 -0
- package/plugins/kk/scripts/cover-compositor.ts +198 -0
- package/plugins/kk/scripts/daily-cover-mock.ts +164 -0
- package/plugins/kk/scripts/daily-scheduled-run.ts +188 -3
- package/plugins/kk/scripts/daily-stages.ts +134 -26
- package/plugins/kk/scripts/daily-triage-core.ts +451 -0
- package/plugins/kk/scripts/daily-triage.ts +74 -0
- package/plugins/kk/scripts/itc-stages.ts +3 -2
- package/plugins/kk/scripts/kk-workflow-stages.ts +31 -2
- package/plugins/kk/scripts/voice3-publish-window.ts +5 -1
- package/plugins/kk/skills/content-safety/references/platforms/wechatmp.md +16 -10
- package/plugins/kk/skills/news-editorial/SKILL.md +3 -3
- package/plugins/kk/skills/news-editorial/references/style-contract.zh.md +2 -1
- package/plugins/kk/skills/publish/SKILL.md +1 -1
- package/plugins/kk/skills/wiki-authoring/SKILL.md +53 -0
- package/plugins/kk/skills/wiki-authoring/references/page-shapes.md +44 -0
- package/plugins/kk/workflows/kk-daily-ai-voice3.yaml +3 -3
- package/plugins/kk/workflows/kk-daily-publish3.yaml +10 -3
- package/plugins/kk/workflows/kk-daily-safety.yaml +32 -7
- package/plugins/publishings/bilibili-pub/dist/index.js +90 -17
- package/plugins/publishings/bilibili-pub/dist/profile-check.js +90 -16
- package/plugins/publishings/cnblogs-pub/dist/index.js +90 -17
- package/plugins/publishings/cnblogs-pub/dist/profile-check.js +90 -16
- package/plugins/publishings/csdn-pub/dist/index.js +90 -17
- package/plugins/publishings/csdn-pub/dist/profile-check.js +91 -17
- package/plugins/publishings/emdash-pub/dist/index.js +1 -1
- package/plugins/publishings/infoq-pub/dist/index.js +120 -19
- package/plugins/publishings/infoq-pub/dist/profile-check.js +95 -18
- package/plugins/publishings/infoq-pub/src/index.ts +40 -1
- package/plugins/publishings/jike-pub/dist/index.js +90 -17
- package/plugins/publishings/jike-pub/dist/profile-check.js +91 -17
- package/plugins/publishings/juejin-pub/dist/index.js +117 -20
- package/plugins/publishings/juejin-pub/dist/profile-check.js +94 -18
- package/plugins/publishings/juejin-pub/src/index.ts +41 -2
- package/plugins/publishings/linkedin-pub/dist/index.js +90 -17
- package/plugins/publishings/linkedin-pub/dist/profile-check.js +91 -17
- package/plugins/publishings/medium-pub/dist/index.js +1 -1
- package/plugins/publishings/podcast-pub/dist/index.js +1 -1
- package/plugins/publishings/qiita-pub/dist/index.js +1 -1
- package/plugins/publishings/shipinhao-pub/dist/index.js +311 -66
- package/plugins/publishings/shipinhao-pub/dist/profile-check.js +138 -17
- package/plugins/publishings/shipinhao-pub/plugin.json +2 -2
- package/plugins/publishings/shipinhao-pub/src/flow.ts +335 -79
- package/plugins/publishings/shipinhao-pub/src/index.ts +16 -8
- package/plugins/publishings/shipinhao-pub/src/profile-check.ts +1 -1
- package/plugins/publishings/shipinhao-pub/src/selectors.ts +103 -5
- package/plugins/publishings/sspai-pub/dist/index.js +90 -17
- package/plugins/publishings/sspai-pub/dist/profile-check.js +90 -16
- package/plugins/publishings/substack-pub/dist/index.js +90 -17
- package/plugins/publishings/substack-pub/dist/profile-check.js +91 -17
- package/plugins/publishings/surfdash-pub/dist/index.js +244 -13
- package/plugins/publishings/surfdash-pub/src/index.ts +144 -8
- package/plugins/publishings/surfdash-pub/src/topic-claims.ts +189 -0
- package/plugins/publishings/threads-pub/dist/index.js +1 -1
- package/plugins/publishings/wechatmp-pub/dist/index.js +186 -39
- package/plugins/publishings/wechatmp-pub/dist/profile-check.js +96 -19
- package/plugins/publishings/wechatmp-pub/src/cgi-draft.ts +14 -2
- package/plugins/publishings/wechatmp-pub/src/enrich.ts +10 -3
- package/plugins/publishings/wechatmp-pub/src/flow.ts +158 -25
- package/plugins/publishings/wechatmp-pub/src/page.ts +14 -0
- package/plugins/publishings/wechatmp-pub/src/profile-check.ts +8 -1
- package/plugins/publishings/weibo-pub/dist/index.js +90 -17
- package/plugins/publishings/weibo-pub/dist/profile-check.js +91 -17
- package/plugins/publishings/x-pub/dist/index.js +90 -17
- package/plugins/publishings/x-pub/dist/profile-check.js +91 -17
- package/plugins/publishings/xhs-pub/dist/index.js +646 -47
- package/plugins/publishings/xhs-pub/dist/profile-check.js +109 -17
- package/plugins/publishings/xhs-pub/src/errors.ts +45 -0
- package/plugins/publishings/xhs-pub/src/flow.ts +773 -45
- package/plugins/publishings/xhs-pub/src/page.ts +33 -0
- package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +90 -17
- package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +90 -16
- package/plugins/publishings/zenn-pub/dist/index.js +94 -2
- package/plugins/publishings/zenn-pub/src/index.ts +134 -1
|
@@ -430,6 +430,21 @@ export function dailyExtract(args: string[]): void {
|
|
|
430
430
|
}
|
|
431
431
|
timed(workDir, 'extract', () => {
|
|
432
432
|
mkdirSync(join(workDir, '10-collect'), { recursive: true });
|
|
433
|
+
// 0347 F6 (2026-11-10): extract re-reads the store on every rerun, so a next-day retry of a
|
|
434
|
+
// failed episode saw overnight collects invalidate the plan fingerprint and the plan stage
|
|
435
|
+
// fail-closed ("refusing to pair a new plan with stale outputs"). Once the plan has
|
|
436
|
+
// authored its output, the episode is frozen: keep the pool byte-for-byte so a rerun
|
|
437
|
+
// resumes the same material (work dirs are per-run-date, so the 21-plan prefix glob is
|
|
438
|
+
// unambiguous). Removing the pool or the plan files re-extracts deliberately.
|
|
439
|
+
const planAuthored = existsSync(join(workDir, '21-plan'))
|
|
440
|
+
? readdirSync(join(workDir, '21-plan')).some(
|
|
441
|
+
(entry) => entry.endsWith('_03_plan_content.json') || entry.endsWith('_03_plan_plan.json'),
|
|
442
|
+
)
|
|
443
|
+
: false;
|
|
444
|
+
if (planAuthored && isFile(poolPath)) {
|
|
445
|
+
console.error(`extract: plan already authored — keeping the frozen pool (${poolPath})`);
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
433
448
|
let chosen: { window: string; docs: unknown[] } | null = null;
|
|
434
449
|
for (const ms of windows) {
|
|
435
450
|
const label = formatWindowMs(ms);
|
|
@@ -1037,9 +1052,9 @@ export function dailyGenerate(args: string[]): void {
|
|
|
1037
1052
|
// Pre-spend script floor gate (2026-10-22). QC's candidate-text estimate does not predict the
|
|
1038
1053
|
// spoken length — 20261020 planned 3968 chars and rendered 8.4 min, 20261021 planned 4548 and
|
|
1039
1054
|
// rendered 17.9 — but the authored VoiceScript IS the spoken text, and 14 measured episodes
|
|
1040
|
-
// deliver it at 5.24-5.94 chars/s.
|
|
1041
|
-
//
|
|
1042
|
-
// the
|
|
1055
|
+
// deliver it at 5.24-5.94 chars/s. The floor estimate uses `scriptFloorCharRate`, NOT
|
|
1056
|
+
// `spokenCharRate`: the fit rate's slow calibration over-predicts minutes and passes a thin
|
|
1057
|
+
// script into the full synthesis, which the measured gate then refuses (20261111).
|
|
1043
1058
|
const minMinutes = episodeMinMinutes === '' ? 0 : Number(episodeMinMinutes);
|
|
1044
1059
|
if (!Number.isFinite(minMinutes) || minMinutes < 0) {
|
|
1045
1060
|
failWith(1, `generate: invalid episode_min_minutes: ${episodeMinMinutes}`);
|
|
@@ -1055,7 +1070,7 @@ export function dailyGenerate(args: string[]): void {
|
|
|
1055
1070
|
(sum, segment) => sum + (typeof segment.text === 'string' ? segment.text.length : 0),
|
|
1056
1071
|
0,
|
|
1057
1072
|
);
|
|
1058
|
-
const charRate =
|
|
1073
|
+
const charRate = scriptFloorCharRate(vdriver);
|
|
1059
1074
|
const seconds = 8 + chars / charRate;
|
|
1060
1075
|
if (seconds < minMinutes * 60) {
|
|
1061
1076
|
refuseScriptBelowFloor(workDir, runDate, { chars, charRate, seconds, minMinutes });
|
|
@@ -1631,10 +1646,15 @@ export function dailyPlan(args: string[]): void {
|
|
|
1631
1646
|
if (isFile(target)) {
|
|
1632
1647
|
const descendants = authoredPlanDescendants(workDir, runDate);
|
|
1633
1648
|
if (descendants.length > 0) {
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1649
|
+
// 0347 F6 (2026-11-10): the pool can drift between the authoring day and a rerun
|
|
1650
|
+
// (overnight collects grow the store; extract-overwrite used to break the
|
|
1651
|
+
// fingerprint). Keeping the existing plan pairs old artifacts with the plan that
|
|
1652
|
+
// actually produced them — the pairing the old refusal guarded. Rebuilding from
|
|
1653
|
+
// the current pool is explicit: delete the 21-plan outputs and the descendants.
|
|
1654
|
+
console.error(
|
|
1655
|
+
`plan: pool changed after authoring — keeping the existing plan and its ${descendants.length} downstream artifact(s) (delete 21-plan/${runDate}_03_plan_*.* and the descendants to rebuild)`,
|
|
1637
1656
|
);
|
|
1657
|
+
return;
|
|
1638
1658
|
}
|
|
1639
1659
|
console.log(`plan cache stale: ${target}`);
|
|
1640
1660
|
}
|
|
@@ -1885,7 +1905,12 @@ function weightedLength(text: string): number {
|
|
|
1885
1905
|
*/
|
|
1886
1906
|
export function buildSocialContent(
|
|
1887
1907
|
copy: string,
|
|
1888
|
-
options: {
|
|
1908
|
+
options: {
|
|
1909
|
+
platform: string;
|
|
1910
|
+
limit: SocialLimit;
|
|
1911
|
+
coverPath?: string;
|
|
1912
|
+
cardPath?: string;
|
|
1913
|
+
},
|
|
1889
1914
|
): Record<string, unknown> {
|
|
1890
1915
|
const trimmed = copy.trim();
|
|
1891
1916
|
const measure = (text: string): number => (options.limit.weighted === true ? weightedLength(text) : text.length);
|
|
@@ -1903,6 +1928,7 @@ export function buildSocialContent(
|
|
|
1903
1928
|
}
|
|
1904
1929
|
body = kept;
|
|
1905
1930
|
}
|
|
1931
|
+
const attachedImage = options.cardPath ?? options.coverPath;
|
|
1906
1932
|
return {
|
|
1907
1933
|
title: `${options.platform} · 每日AI乱炖`,
|
|
1908
1934
|
format: 'text',
|
|
@@ -1915,7 +1941,7 @@ export function buildSocialContent(
|
|
|
1915
1941
|
truncatedFrom: measure(trimmed),
|
|
1916
1942
|
truncatedUnit: options.limit.weighted === true ? 'weighted' : 'code_units',
|
|
1917
1943
|
}),
|
|
1918
|
-
...(
|
|
1944
|
+
...(attachedImage === undefined ? {} : { coverImage: attachedImage }),
|
|
1919
1945
|
},
|
|
1920
1946
|
};
|
|
1921
1947
|
}
|
|
@@ -2020,11 +2046,22 @@ export function dailyBundleVariants(args: string[]): void {
|
|
|
2020
2046
|
);
|
|
2021
2047
|
}
|
|
2022
2048
|
|
|
2049
|
+
const cards = cardsEnabledArg !== 'false' ? readJson(cardsPath) : null;
|
|
2050
|
+
let cardImage: string | undefined;
|
|
2051
|
+
if (cards !== null && Array.isArray((cards.metadata as Record<string, unknown> | undefined)?.images)) {
|
|
2052
|
+
const rawImages = (cards.metadata as Record<string, unknown>).images as Array<{ path?: string }>;
|
|
2053
|
+
if (rawImages.length > 0 && typeof rawImages[0]?.path === 'string' && isFile(rawImages[0].path)) {
|
|
2054
|
+
cardImage = resolve(rawImages[0].path);
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2023
2058
|
if (cardsEnabledArg === 'false') skipped.push('cards (cards_enabled=false)');
|
|
2024
2059
|
else {
|
|
2025
|
-
const cards = readJson(cardsPath);
|
|
2026
2060
|
if (cards === null) skipped.push('cards (no rendered card series)');
|
|
2027
|
-
else
|
|
2061
|
+
else {
|
|
2062
|
+
write('cards', buildXhsCardsContent(cards, { publishStatus: 'draft' }));
|
|
2063
|
+
write('cards@xhs-pub', buildXhsCardsContent(cards, { publishStatus: 'draft' }));
|
|
2064
|
+
}
|
|
2028
2065
|
}
|
|
2029
2066
|
|
|
2030
2067
|
for (const platform of Object.keys(SOCIAL_LIMITS)) {
|
|
@@ -2040,6 +2077,7 @@ export function dailyBundleVariants(args: string[]): void {
|
|
|
2040
2077
|
platform,
|
|
2041
2078
|
limit,
|
|
2042
2079
|
...(cover === undefined ? {} : { coverPath: cover }),
|
|
2080
|
+
...(cardImage === undefined ? {} : { cardPath: cardImage }),
|
|
2043
2081
|
}),
|
|
2044
2082
|
);
|
|
2045
2083
|
}
|
|
@@ -3330,10 +3368,20 @@ export function dailySafetyGate(args: string[]): void {
|
|
|
3330
3368
|
status = 'exclude';
|
|
3331
3369
|
reason = 'RISK decisions carry only gap/note/fix dispositions — recorded, publishing at recorded risk';
|
|
3332
3370
|
} else status = 'pass';
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3371
|
+
// 0347 F4 (2026-11-10): an executor outage must not masquerade as a content verdict. When
|
|
3372
|
+
// the final classification is block AND the evidence the gate grades is missing entirely
|
|
3373
|
+
// (request/report/verdict never appeared because a reviewer or judge agent died), record an
|
|
3374
|
+
// infra marker the `judge -> infra-fail` transition reads; `block` stays reserved for real
|
|
3375
|
+
// content verdicts. The caller contract is unchanged — both terminals are failureStates, so
|
|
3376
|
+
// "non-zero = never publish" holds; infra-fail only makes the death retryable-by-machine and
|
|
3377
|
+
// legible to daily-triage.
|
|
3378
|
+
const infraMarker = scopeArtifact(workDir, scopeDir, runDate, 'safety-infra.json');
|
|
3379
|
+
const infraMissing = [
|
|
3380
|
+
...(request === null ? ['review-request'] : []),
|
|
3381
|
+
...(report === null ? ['review-report'] : []),
|
|
3382
|
+
...(verdict === null ? ['judge-verdict'] : []),
|
|
3383
|
+
];
|
|
3384
|
+
if (status === 'block' && drafts && !edited && infraMissing.length === 0) {
|
|
3337
3385
|
// A quality block poisons the isFile() draft cache: every same-day retry would
|
|
3338
3386
|
// re-fail on unchanged bytes (20261002 dogfood — two judge-fail runs replayed until
|
|
3339
3387
|
// the drafts were moved by hand). Quarantine (mv, never rm) so the next run
|
|
@@ -3348,6 +3396,24 @@ export function dailySafetyGate(args: string[]): void {
|
|
|
3348
3396
|
renameSync(path, dest);
|
|
3349
3397
|
}
|
|
3350
3398
|
}
|
|
3399
|
+
if (status === 'pass' || status === 'escalate' || status === 'exclude') {
|
|
3400
|
+
sted('write', stampFile, () => writeJsonText(stampFile, { digest, status, excludedPlatforms }));
|
|
3401
|
+
}
|
|
3402
|
+
if (status === 'block' && infraMissing.length > 0) {
|
|
3403
|
+
sted('write', infraMarker, () =>
|
|
3404
|
+
writeJsonText(infraMarker, {
|
|
3405
|
+
infra: true,
|
|
3406
|
+
missing: infraMissing,
|
|
3407
|
+
reason,
|
|
3408
|
+
classifiedAt: new Date().toISOString(),
|
|
3409
|
+
}),
|
|
3410
|
+
);
|
|
3411
|
+
console.error(
|
|
3412
|
+
`safety: infra — refusal is due to missing evidence (${infraMissing.join(', ')}), not a content verdict`,
|
|
3413
|
+
);
|
|
3414
|
+
} else if (isFile(infraMarker)) {
|
|
3415
|
+
unlinkSync(infraMarker);
|
|
3416
|
+
}
|
|
3351
3417
|
sted('write', statusFile, () => writeRaw(statusFile, status));
|
|
3352
3418
|
console.log(`safety: status=${status} (${reason}); routing is transition-owned`);
|
|
3353
3419
|
});
|
|
@@ -3877,6 +3943,22 @@ function voicescriptToBlockYaml(script: Record<string, unknown>): string {
|
|
|
3877
3943
|
return lines.join('\n');
|
|
3878
3944
|
}
|
|
3879
3945
|
|
|
3946
|
+
/**
|
|
3947
|
+
* Floor-gate char rate — deliberately separate from `spokenCharRate` because the two consumers
|
|
3948
|
+
* need opposite safe directions. The fit/ceiling budget wants the slow rate (a too-big fit renders
|
|
3949
|
+
* an episode the ceiling then rejects — why gemini was recalibrated to 4.95 on 2026-10-15). The
|
|
3950
|
+
* pre-spend script floor gate wants the opposite: a slow rate over-predicts minutes and passes a
|
|
3951
|
+
* thin script into the 1-2 h synthesis, which the measured gate refuses after the spend
|
|
3952
|
+
* (20261111 a17: 4,805-char script estimated 16.3 min at 4.95, rendered 14.2 min at a measured
|
|
3953
|
+
* 5.64 chars/s; band 5.33-5.88 across 20261004/07 + the 0237 live dry run). 5.6 — the band center
|
|
3954
|
+
* and the voicebox default — refuses a17-class days before any spend; slow-mix days near the
|
|
3955
|
+
* floor may be refused early, the cheaper error per the ceiling gate's own economics.
|
|
3956
|
+
*/
|
|
3957
|
+
function scriptFloorCharRate(vdriver: string): number {
|
|
3958
|
+
if (vdriver === 'gemini') return 5.6;
|
|
3959
|
+
return spokenCharRate(vdriver);
|
|
3960
|
+
}
|
|
3961
|
+
|
|
3880
3962
|
/** Measured driver rates from dailyGenerate. Unknown drivers reuse the voicebox rate. */
|
|
3881
3963
|
function spokenCharRate(vdriver: string): number {
|
|
3882
3964
|
// Recalibrated 2026-10-15: episode measured 7,395 spoken chars / 1,490.9 s across 12 sections
|
|
@@ -4372,12 +4454,35 @@ export function dailyEditorialRender(args: string[]): void {
|
|
|
4372
4454
|
}
|
|
4373
4455
|
|
|
4374
4456
|
// 2. Cover brief: 23-cover/<date>_07_cover-brief.json
|
|
4375
|
-
|
|
4457
|
+
// 0347 R5: cover may be a legacy string (subject only) or `{ scene, headline }` — the
|
|
4458
|
+
// headline falls back to the lead story's title either way.
|
|
4459
|
+
const rawCover = master.cover;
|
|
4460
|
+
let coverSubject = '';
|
|
4461
|
+
let coverHeadline = '';
|
|
4462
|
+
if (typeof rawCover === 'string') {
|
|
4463
|
+
coverSubject = rawCover.trim();
|
|
4464
|
+
} else if (rawCover !== null && typeof rawCover === 'object') {
|
|
4465
|
+
const coverObj = rawCover as Record<string, unknown>;
|
|
4466
|
+
coverSubject = typeof coverObj.scene === 'string' ? coverObj.scene.trim() : '';
|
|
4467
|
+
coverHeadline = typeof coverObj.headline === 'string' ? coverObj.headline.trim() : '';
|
|
4468
|
+
}
|
|
4469
|
+
const leadId = orderedIds[0];
|
|
4470
|
+
const leadDoc = leadId !== undefined ? docById.get(leadId) : undefined;
|
|
4471
|
+
const leadStoryTitle = typeof leadDoc?.title === 'string' ? leadDoc.title.trim() : '';
|
|
4376
4472
|
if (coverSubject !== '') {
|
|
4473
|
+
if (coverHeadline === '' && leadStoryTitle !== '') {
|
|
4474
|
+
coverHeadline = leadStoryTitle;
|
|
4475
|
+
}
|
|
4377
4476
|
const coverDir = join(workDir, '23-cover');
|
|
4378
4477
|
sted('mkdir', coverDir, () => mkdirSync(coverDir, { recursive: true }));
|
|
4379
4478
|
const coverOut = join(coverDir, `${runDate}_07_cover-brief.json`);
|
|
4380
|
-
sted('write', coverOut, () =>
|
|
4479
|
+
sted('write', coverOut, () =>
|
|
4480
|
+
writeJsonText(coverOut, {
|
|
4481
|
+
subject: coverSubject,
|
|
4482
|
+
headline: coverHeadline,
|
|
4483
|
+
leadStoryTitle,
|
|
4484
|
+
}),
|
|
4485
|
+
);
|
|
4381
4486
|
console.log(`editorial-render: wrote cover brief: ${coverOut}`);
|
|
4382
4487
|
} else {
|
|
4383
4488
|
console.log('editorial-render: skipping cover brief (missing cover in script plan)');
|
|
@@ -4476,29 +4581,32 @@ export function dailyEditorialRender(args: string[]): void {
|
|
|
4476
4581
|
}
|
|
4477
4582
|
}
|
|
4478
4583
|
|
|
4479
|
-
// 4 & 5. Social posts: 26-social/{x,threads}.md and
|
|
4584
|
+
// 4 & 5. Social posts: unified short notice for 26-social/{x,threads,weibo}.md; linkedin.md (and weibo fallback) long
|
|
4480
4585
|
const social =
|
|
4481
4586
|
master.social !== null && typeof master.social === 'object' ? (master.social as Record<string, unknown>) : null;
|
|
4482
4587
|
const socialShort = typeof social?.short === 'string' ? social.short.trim() : '';
|
|
4588
|
+
const socialLong = typeof social?.long === 'string' ? social.long.trim() : '';
|
|
4483
4589
|
const socialDir = join(workDir, '26-social');
|
|
4484
4590
|
if (socialShort !== '') {
|
|
4485
4591
|
sted('mkdir', socialDir, () => mkdirSync(socialDir, { recursive: true }));
|
|
4486
|
-
for (const name of ['x.md', 'threads.md']) {
|
|
4592
|
+
for (const name of ['x.md', 'threads.md', 'weibo.md']) {
|
|
4487
4593
|
const out = join(socialDir, name);
|
|
4488
4594
|
sted('write', out, () => writeRaw(out, `${socialShort}\n`));
|
|
4489
4595
|
}
|
|
4490
|
-
console.log('editorial-render: wrote 26-social/{x,threads}.md');
|
|
4596
|
+
console.log('editorial-render: wrote 26-social/{x,threads,weibo}.md');
|
|
4597
|
+
} else if (socialLong !== '') {
|
|
4598
|
+
sted('mkdir', socialDir, () => mkdirSync(socialDir, { recursive: true }));
|
|
4599
|
+
const out = join(socialDir, 'weibo.md');
|
|
4600
|
+
sted('write', out, () => writeRaw(out, `${socialLong}\n`));
|
|
4601
|
+
console.log('editorial-render: wrote 26-social/weibo.md from social.long');
|
|
4491
4602
|
} else {
|
|
4492
4603
|
console.log('editorial-render: skipping social short posts (missing social.short in script plan)');
|
|
4493
4604
|
}
|
|
4494
|
-
const socialLong = typeof social?.long === 'string' ? social.long.trim() : '';
|
|
4495
4605
|
if (socialLong !== '') {
|
|
4496
4606
|
sted('mkdir', socialDir, () => mkdirSync(socialDir, { recursive: true }));
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
}
|
|
4501
|
-
console.log('editorial-render: wrote 26-social/{weibo,linkedin}.md');
|
|
4607
|
+
const out = join(socialDir, 'linkedin.md');
|
|
4608
|
+
sted('write', out, () => writeRaw(out, `${socialLong}\n`));
|
|
4609
|
+
console.log('editorial-render: wrote 26-social/linkedin.md');
|
|
4502
4610
|
} else {
|
|
4503
4611
|
console.log('editorial-render: skipping social long posts (missing social.long in script plan)');
|
|
4504
4612
|
}
|