@gobing-ai/knowledge-kit 0.0.28 → 0.0.30

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.
Files changed (97) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/index.js +114 -38
  3. package/package.json +1 -1
  4. package/plugins/generations/daily-article-gen/dist/index.js +45 -5
  5. package/plugins/generations/daily-article-gen/src/index.ts +59 -4
  6. package/plugins/generations/dailynews-gen/dist/index.js +46 -9
  7. package/plugins/generations/dailynews-gen/src/index.ts +36 -1
  8. package/plugins/generations/dailynews-gen/src/script-builder.ts +15 -12
  9. package/plugins/generations/dailynews-gen/src/script-plan.ts +21 -3
  10. package/plugins/generations/episode-plan-gen/dist/index.js +55 -4
  11. package/plugins/generations/episode-plan-gen/src/index.ts +80 -2
  12. package/plugins/generations/image-gen/assets/fonts/NotoSansSC-Bold.otf +0 -0
  13. package/plugins/generations/image-gen/assets/fonts/NotoSansSC-Regular.otf +0 -0
  14. package/plugins/generations/image-gen/assets/fonts/OFL.txt +92 -0
  15. package/plugins/generations/image-gen/assets/fonts/SOURCE.md +15 -0
  16. package/plugins/generations/image-gen/dist/index.js +700 -22
  17. package/plugins/generations/image-gen/package.json +1 -0
  18. package/plugins/generations/image-gen/presets/formats/daily-news-cover.yaml +2 -2
  19. package/plugins/generations/image-gen/presets/formats/xhs-card.yaml +19 -11
  20. package/plugins/generations/image-gen/presets/styles/xhs-knowledge.yaml +2 -1
  21. package/plugins/generations/image-gen/scripts/compose-e2e-artifact.ts +135 -0
  22. package/plugins/generations/image-gen/src/bytes.ts +116 -0
  23. package/plugins/generations/image-gen/src/compose/card.ts +294 -0
  24. package/plugins/generations/image-gen/src/compose/chromium.ts +147 -0
  25. package/plugins/generations/image-gen/src/compose/cmap.ts +177 -0
  26. package/plugins/generations/image-gen/src/index.ts +211 -13
  27. package/plugins/generations/image-gen/src/job.ts +12 -0
  28. package/plugins/generations/image-gen/src/presets.ts +53 -13
  29. package/plugins/generations/image-gen/src/providers/minimax.ts +12 -4
  30. package/plugins/generations/image-gen/src/providers/types.ts +12 -1
  31. package/plugins/kk/plugin.json +1 -1
  32. package/plugins/kk/scripts/daily-voice-style.zh.md +27 -14
  33. package/plugins/kk/scripts/itc-stages.ts +21 -3
  34. package/plugins/kk/scripts/kk-workflow-stages.ts +461 -10
  35. package/plugins/kk/scripts/topic-boundary.json +96 -0
  36. package/plugins/kk/scripts/validate-voicescript.ts +15 -0
  37. package/plugins/kk/skills/content-judge/SKILL.md +30 -0
  38. package/plugins/kk/skills/content-judge/references/workflow-integration.md +9 -2
  39. package/plugins/kk/skills/content-safety/SKILL.md +163 -0
  40. package/plugins/kk/skills/content-safety/references/platforms/apple-podcasts.md +36 -0
  41. package/plugins/kk/skills/content-safety/references/platforms/netease-music.md +31 -0
  42. package/plugins/kk/skills/content-safety/references/platforms/wechatmp.md +32 -0
  43. package/plugins/kk/skills/content-safety/references/platforms/xiaoyuzhou.md +35 -0
  44. package/plugins/kk/skills/publish/SKILL.md +1 -1
  45. package/plugins/kk/skills/xhs-images/SKILL.md +11 -7
  46. package/plugins/kk/skills/xhs-images/references/card-layouts.md +4 -4
  47. package/plugins/kk/workflows/judge-gated-publish-example.yaml +18 -10
  48. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +139 -24
  49. package/plugins/kk/workflows/kk-itc.yaml +21 -8
  50. package/plugins/publishings/podcast-pub/dist/index.js +4 -0
  51. package/plugins/publishings/podcast-pub/src/index.ts +2 -0
  52. package/plugins/publishings/podcast-pub/src/show-notes.ts +6 -0
  53. package/plugins/publishings/xhs-pub/dist/index.js +1 -1
  54. package/plugins/publishings/xhs-pub/src/automation-guard.ts +2 -2
  55. package/plugins/publishings/xhs-pub/src/index.ts +1 -1
  56. package/plugins/publishings/xhs-pub/src/profile-check.ts +2 -2
  57. package/plugins/sp/lib/env.ts +0 -46
  58. package/plugins/sp/lib/inline-run.generated.mjs +0 -1489
  59. package/plugins/sp/scripts/batch-preflight.mjs +0 -346
  60. package/plugins/sp/scripts/batch-preflight.ts +0 -459
  61. package/plugins/sp/scripts/daily-summary/daily-summary.mjs +0 -615
  62. package/plugins/sp/scripts/daily-summary/daily-summary.ts +0 -846
  63. package/plugins/sp/scripts/daily-summary/logger.ts +0 -28
  64. package/plugins/sp/scripts/dogfood-testing/detect-pipeline-driving.mjs +0 -223
  65. package/plugins/sp/scripts/dogfood-testing/detect-pipeline-driving.ts +0 -367
  66. package/plugins/sp/scripts/dogfood-testing/validate-report.mjs +0 -132
  67. package/plugins/sp/scripts/dogfood-testing/validate-report.ts +0 -169
  68. package/plugins/sp/scripts/feature-dev-precheck.mjs +0 -171
  69. package/plugins/sp/scripts/feature-dev-precheck.ts +0 -238
  70. package/plugins/sp/scripts/feature-sync-bounded.mjs +0 -285
  71. package/plugins/sp/scripts/feature-sync-bounded.ts +0 -478
  72. package/plugins/sp/scripts/feature-verification-steps.ts +0 -275
  73. package/plugins/sp/scripts/history-anatomy-cache.mjs +0 -902
  74. package/plugins/sp/scripts/history-anatomy-cache.ts +0 -1028
  75. package/plugins/sp/scripts/idea-handoff.mjs +0 -22
  76. package/plugins/sp/scripts/idea-handoff.ts +0 -44
  77. package/plugins/sp/scripts/inline-pipeline-parity-check.ts +0 -185
  78. package/plugins/sp/scripts/inline-run-setup.ts +0 -722
  79. package/plugins/sp/scripts/pr-reviewing.mjs +0 -769
  80. package/plugins/sp/scripts/pr-reviewing.ts +0 -925
  81. package/plugins/sp/scripts/quality-gate.mjs +0 -179
  82. package/plugins/sp/scripts/quality-gate.ts +0 -217
  83. package/plugins/sp/scripts/script-contract-check.ts +0 -319
  84. package/plugins/sp/scripts/stage-registry-adapter.ts +0 -1533
  85. package/plugins/sp/scripts/surface-drift-inventory.ts +0 -929
  86. package/plugins/sp/scripts/task-evidence-precheck.ts +0 -181
  87. package/plugins/sp/scripts/task-size-precheck.ts +0 -175
  88. package/plugins/sp/scripts/transition-shim-check.ts +0 -238
  89. package/plugins/sp/scripts/validate-commands.ts +0 -689
  90. package/plugins/sp/scripts/validate-flag-contracts.ts +0 -878
  91. package/plugins/sp/scripts/verify-answer-lint.ts +0 -530
  92. package/plugins/sp/scripts/workflow-step-profile.mjs +0 -316
  93. package/plugins/sp/scripts/workflow-step-profile.ts +0 -456
  94. package/plugins/sp/scripts/wrapup-drift-probe.mjs +0 -190
  95. package/plugins/sp/scripts/wrapup-drift-probe.ts +0 -258
  96. package/plugins/sp/scripts/wrapup-steps.mjs +0 -444
  97. package/plugins/sp/scripts/wrapup-steps.ts +0 -552
@@ -1,258 +0,0 @@
1
- #!/usr/bin/env bun
2
- /**
3
- * wrapup-drift-probe — deterministic doc-ownership drift probe behind the wrapup-pipeline
4
- * task-resolve onEnter (task 0944, feature D64, ADR-115 composition budgets).
5
- *
6
- * Reads the validated wrapup capture `.spur/run/<runId>-wrapup-tasks.json` (never raw
7
- * vars.tasks — 0783 contract), runs `spur task show <wbs> --json` per member, collects the
8
- * changed paths from each task's `### Solution` file:line map, and writes:
9
- * - `<runId>-drift-probe.json` `{ clean: boolean, reasons: string[], paths: string[] }`
10
- * - `<runId>-mode.txt` projected wrapup mode: `fast` when clean, empty otherwise
11
- *
12
- * The probe runs ONLY when the caller left `mode` empty; a caller-set mode is projected
13
- * verbatim by the workflow wrapper and this script is never invoked (0944 R3).
14
- *
15
- * Dirty (clean=false, mode stays empty → the safety route) whenever ANY changed path
16
- * matches a doc-owned surface (AGENTS.md doc map + docs/99_PROJECT_CONSTITUTION.md
17
- * ownership table), or a task's Solution section is empty or unparseable (fail safe —
18
- * a wrapup without a readable change map must still reach doc-sync). Paths under the
19
- * task/feature corpus are never treated as drift.
20
- *
21
- * Node-builtin imports only; the spur lookup is a spawnable `SpurRunner` so tests can
22
- * fake it; `main(argv, env, options)` is the same injection point the workflow wrapper
23
- * and its node twin exercise. Always exits 0 after probing; only an empty `__runId`
24
- * (mis-invocation) exits 1.
25
- */
26
-
27
- import { spawnSync } from 'node:child_process';
28
- import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
29
- import { join } from 'node:path';
30
- import { getEnvVars } from '../lib/env';
31
-
32
- export interface DriftProbeEnv {
33
- __runId?: string;
34
- spurBin?: string;
35
- [key: string]: string | undefined;
36
- }
37
-
38
- export interface DriftProbeOptions {
39
- /** Base directory for `.spur/run`; defaults to the process cwd. */
40
- cwd?: string;
41
- }
42
-
43
- /** Minimal spawnable spur surface — tests fake this to return canned `task show` output. */
44
- export interface SpurShowResult {
45
- status: number;
46
- stdout: string;
47
- }
48
- export type SpurRunner = (args: string[]) => SpurShowResult;
49
-
50
- export interface DriftProbeResult {
51
- clean: boolean;
52
- reasons: string[];
53
- paths: string[];
54
- probeFile: string;
55
- modeFile: string;
56
- /** Exit code the workflow wrapper observes (only an empty __runId is a hard failure). */
57
- exitCode: number;
58
- }
59
-
60
- /**
61
- * Doc-owned surfaces (0944 R2): a changed path under any of these means doc-sync must
62
- * still run. Mirrors the AGENTS.md documentation map and the
63
- * docs/99_PROJECT_CONSTITUTION.md ownership table: contracts / cli commands / config /
64
- * migrations / workflow YAML / plugin commands, skills and hooks / root manifest / the
65
- * authoritative docs (00_ADR, 03_ARCHITECTURE, 04_DESIGN, docs/design). docs/tasks* and
66
- * docs/features/* (the corpus) are intentionally absent — they are never drift.
67
- *
68
- * WHY join('config', 'workflows'): rule sp-runtime-path forbids the literal
69
- * config/<dir> in runtime source; this constant is a drift TARGET (Solution
70
- * change-map paths against the build-time SSOT), not a runtime config read.
71
- */
72
- const WORKFLOWS_GLOB = `${join('config', 'workflows')}/**`;
73
- export const DOC_OWNED_SURFACES = [
74
- 'packages/contracts/**',
75
- 'apps/cli/src/commands/**',
76
- 'packages/config/src/**',
77
- 'drizzle/*.sql',
78
- WORKFLOWS_GLOB,
79
- 'plugins/sp/commands/**',
80
- 'plugins/sp/skills/**',
81
- 'plugins/sp/hooks/**',
82
- 'package.json',
83
- 'docs/00_ADR.md',
84
- 'docs/03_ARCHITECTURE.md',
85
- 'docs/04_DESIGN.md',
86
- 'docs/design/**',
87
- ] as const;
88
-
89
- /**
90
- * Top-level workspace entries from the AGENTS.md stack layout. A changed path whose first
91
- * segment is none of these is a new top-level workspace directory — doc-owned by default.
92
- * Single-segment paths (root files) are not directories and are exempt.
93
- */
94
- const KNOWN_TOP_LEVEL = new Set([
95
- 'apps',
96
- 'packages',
97
- 'plugins',
98
- 'config',
99
- 'docs',
100
- 'drizzle',
101
- 'scripts',
102
- 'vendors',
103
- 'package.json',
104
- 'bun.lock',
105
- 'bunfig.toml',
106
- ]);
107
-
108
- /** Corpus paths (task/feature records) are never drift — excluded before surface matching. */
109
- const CORPUS_PREFIXES = ['docs/tasks', 'docs/features/'];
110
-
111
- /** `### Solution` section of a task record (tolerates `##`–`####` heading depth). */
112
- export function solutionSectionOf(content: string): string | null {
113
- const heading = /^#{2,4}\s+Solution\s*$/m.exec(content);
114
- if (!heading) return null;
115
- const rest = content.slice(heading.index + heading[0].length);
116
- const next = /^#{2,4}\s+\S/m.exec(rest);
117
- return next ? rest.slice(0, next.index) : rest;
118
- }
119
-
120
- const CHANGE_ENTRY = /`([^`\r\n]+):(\d+)(?:-\d+)?`/g;
121
-
122
- /** Backticked `path:line` (or `path:line-range`) tokens from a Solution section. */
123
- export function changedPathsOf(section: string | null): string[] {
124
- if (section === null) return [];
125
- const paths: string[] = [];
126
- for (const match of section.matchAll(CHANGE_ENTRY)) {
127
- const path = match[1];
128
- // Path-like: no whitespace and at least one separator or dotted suffix, so prose
129
- // backticks never masquerade as change-map entries.
130
- if (/\s/.test(path)) continue;
131
- if (!path.includes('/') && !path.includes('.')) continue;
132
- paths.push(path);
133
- }
134
- return paths;
135
- }
136
-
137
- function surfaceRegex(glob: string): RegExp {
138
- const escaped = glob
139
- .replace(/[.+^${}()|[\]\\]/g, '\\$&')
140
- .replaceAll('**', '\u0000')
141
- .replaceAll('*', '[^/]*')
142
- .replaceAll('\u0000', '.*');
143
- return new RegExp(`^${escaped}$`);
144
- }
145
-
146
- const SURFACE_MATCHERS = DOC_OWNED_SURFACES.map((glob) => ({ glob, regex: surfaceRegex(glob) }));
147
-
148
- /** 0944 R2 surface match: doc-owned glob, corpus exclusion, new top-level directory. */
149
- export function driftReasonForPath(path: string): string | null {
150
- if (CORPUS_PREFIXES.some((prefix) => path.startsWith(prefix))) return null;
151
- if (path.includes('/') && !KNOWN_TOP_LEVEL.has(path.split('/')[0])) {
152
- return 'new top-level workspace directory';
153
- }
154
- const match = SURFACE_MATCHERS.find((entry) => entry.regex.test(path));
155
- return match ? `matches doc-owned surface ${match.glob}` : null;
156
- }
157
-
158
- function defaultSpurRunner(env: DriftProbeEnv, cwd?: string): SpurRunner {
159
- const parts = (env.spurBin ?? 'spur').split(/\s+/).filter((part) => part.length > 0);
160
- return (args: string[]): SpurShowResult => {
161
- const run = spawnSync(parts[0], [...parts.slice(1), ...args], {
162
- cwd,
163
- encoding: 'utf8',
164
- env: getEnvVars(),
165
- });
166
- return { status: run.status ?? 1, stdout: run.stdout ?? '' };
167
- };
168
- }
169
-
170
- /**
171
- * `probe` — classify the wrapup as clean (pure application-code change, no doc-owned
172
- * surface touched) or dirty, and project the wrapup mode. Fail safe: every lookup or
173
- * parse problem is a dirty probe, never a silent clean.
174
- */
175
- export function runDriftProbe(
176
- env: DriftProbeEnv,
177
- options: DriftProbeOptions = {},
178
- spur = defaultSpurRunner(env, options.cwd),
179
- ): DriftProbeResult {
180
- const cwd = options.cwd;
181
- const runId = env.__runId ?? '';
182
- if (runId.length === 0) {
183
- process.stderr.write('wrapup-drift-probe: __runId is empty — refusing the legacy fixed-path fallback\n');
184
- return { clean: false, reasons: [], paths: [], probeFile: '', modeFile: '', exitCode: 1 };
185
- }
186
- const relProbeFile = join('.spur', 'run', `${runId}-drift-probe.json`);
187
- const relModeFile = join('.spur', 'run', `${runId}-mode.txt`);
188
- const relTasksFile = join('.spur', 'run', `${runId}-wrapup-tasks.json`);
189
- const abs = (p: string): string => (cwd ? join(cwd, p) : p);
190
- mkdirSync(abs(join('.spur', 'run')), { recursive: true });
191
- // Write the dirty projection first so a crash mid-probe fails safe (mode stays empty).
192
- writeFileSync(abs(relModeFile), '\n');
193
-
194
- const finish = (clean: boolean, reasons: string[], paths: string[]): DriftProbeResult => {
195
- writeFileSync(abs(relProbeFile), `${JSON.stringify({ clean, reasons, paths })}\n`);
196
- writeFileSync(abs(relModeFile), clean ? 'fast\n' : '\n');
197
- return { clean, reasons, paths, probeFile: relProbeFile, modeFile: relModeFile, exitCode: 0 };
198
- };
199
-
200
- let tasks: unknown;
201
- try {
202
- tasks = JSON.parse(readFileSync(abs(relTasksFile), 'utf8'));
203
- } catch {
204
- tasks = undefined;
205
- }
206
- if (!Array.isArray(tasks) || !tasks.every((wbs) => typeof wbs === 'string')) {
207
- process.stderr.write(
208
- 'wrapup-drift-probe: normalized task capture is missing or corrupted — failing safe (dirty)\n',
209
- );
210
- return finish(false, ['normalized task capture missing or corrupted'], []);
211
- }
212
-
213
- const reasons: string[] = [];
214
- const allPaths = new Set<string>();
215
- for (const wbs of tasks as string[]) {
216
- const shown = spur(['task', 'show', wbs, '--json']);
217
- if (shown.status !== 0) {
218
- reasons.push(`${wbs}: task show failed (status=${shown.status})`);
219
- continue;
220
- }
221
- let content: unknown;
222
- try {
223
- content = JSON.parse(shown.stdout).content;
224
- } catch {
225
- content = undefined;
226
- }
227
- if (typeof content !== 'string') {
228
- reasons.push(`${wbs}: task show output unparseable`);
229
- continue;
230
- }
231
- const changedPaths = changedPathsOf(solutionSectionOf(content));
232
- if (changedPaths.length === 0) {
233
- reasons.push(`${wbs}: Solution empty or unparseable`);
234
- continue;
235
- }
236
- for (const path of changedPaths) {
237
- if (CORPUS_PREFIXES.some((prefix) => path.startsWith(prefix))) continue;
238
- allPaths.add(path);
239
- const drift = driftReasonForPath(path);
240
- if (drift) reasons.push(`${wbs}: ${path} ${drift}`);
241
- }
242
- }
243
- return finish(reasons.length === 0, reasons, [...allPaths].sort());
244
- }
245
-
246
- export const WRAPUP_DRIFT_PROBE_USAGE = 'usage: wrapup-drift-probe (env: __runId, spurBin)';
247
-
248
- export function main(argv: string[], env: DriftProbeEnv = getEnvVars(), options: DriftProbeOptions = {}): number {
249
- if (argv.length > 0) {
250
- process.stderr.write(`${WRAPUP_DRIFT_PROBE_USAGE}\n`);
251
- return 2;
252
- }
253
- return runDriftProbe(env, options).exitCode;
254
- }
255
-
256
- if (import.meta.main) {
257
- process.exit(main(process.argv.slice(2)));
258
- }