@gobing-ai/knowledge-kit 0.0.29 → 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 (72) 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 +24 -7
  5. package/plugins/generations/daily-article-gen/src/index.ts +36 -12
  6. package/plugins/generations/dailynews-gen/dist/index.js +19 -2
  7. package/plugins/generations/dailynews-gen/src/index.ts +7 -0
  8. package/plugins/generations/dailynews-gen/src/script-plan.ts +21 -3
  9. package/plugins/generations/episode-plan-gen/dist/index.js +55 -4
  10. package/plugins/generations/episode-plan-gen/src/index.ts +80 -2
  11. package/plugins/generations/image-gen/dist/index.js +122 -20
  12. package/plugins/generations/image-gen/src/bytes.ts +106 -18
  13. package/plugins/generations/image-gen/src/index.ts +46 -6
  14. package/plugins/generations/image-gen/src/job.ts +6 -0
  15. package/plugins/generations/image-gen/src/providers/minimax.ts +12 -4
  16. package/plugins/generations/image-gen/src/providers/types.ts +12 -1
  17. package/plugins/kk/plugin.json +1 -1
  18. package/plugins/kk/scripts/daily-voice-style.zh.md +5 -5
  19. package/plugins/kk/scripts/itc-stages.ts +21 -3
  20. package/plugins/kk/scripts/kk-workflow-stages.ts +199 -7
  21. package/plugins/kk/scripts/topic-boundary.json +3 -12
  22. package/plugins/kk/skills/content-judge/SKILL.md +30 -0
  23. package/plugins/kk/skills/content-judge/references/workflow-integration.md +9 -2
  24. package/plugins/kk/skills/publish/SKILL.md +1 -1
  25. package/plugins/kk/workflows/judge-gated-publish-example.yaml +18 -10
  26. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +39 -14
  27. package/plugins/kk/workflows/kk-itc.yaml +21 -8
  28. package/plugins/publishings/xhs-pub/dist/index.js +1 -1
  29. package/plugins/publishings/xhs-pub/src/automation-guard.ts +2 -2
  30. package/plugins/publishings/xhs-pub/src/index.ts +1 -1
  31. package/plugins/publishings/xhs-pub/src/profile-check.ts +2 -2
  32. package/plugins/sp/lib/env.ts +0 -46
  33. package/plugins/sp/lib/inline-run.generated.mjs +0 -1489
  34. package/plugins/sp/scripts/batch-preflight.mjs +0 -346
  35. package/plugins/sp/scripts/batch-preflight.ts +0 -459
  36. package/plugins/sp/scripts/daily-summary/daily-summary.mjs +0 -615
  37. package/plugins/sp/scripts/daily-summary/daily-summary.ts +0 -846
  38. package/plugins/sp/scripts/daily-summary/logger.ts +0 -28
  39. package/plugins/sp/scripts/dogfood-testing/detect-pipeline-driving.mjs +0 -223
  40. package/plugins/sp/scripts/dogfood-testing/detect-pipeline-driving.ts +0 -367
  41. package/plugins/sp/scripts/dogfood-testing/validate-report.mjs +0 -132
  42. package/plugins/sp/scripts/dogfood-testing/validate-report.ts +0 -169
  43. package/plugins/sp/scripts/feature-dev-precheck.mjs +0 -171
  44. package/plugins/sp/scripts/feature-dev-precheck.ts +0 -238
  45. package/plugins/sp/scripts/feature-sync-bounded.mjs +0 -285
  46. package/plugins/sp/scripts/feature-sync-bounded.ts +0 -478
  47. package/plugins/sp/scripts/feature-verification-steps.ts +0 -275
  48. package/plugins/sp/scripts/history-anatomy-cache.mjs +0 -902
  49. package/plugins/sp/scripts/history-anatomy-cache.ts +0 -1028
  50. package/plugins/sp/scripts/idea-handoff.mjs +0 -22
  51. package/plugins/sp/scripts/idea-handoff.ts +0 -44
  52. package/plugins/sp/scripts/inline-pipeline-parity-check.ts +0 -185
  53. package/plugins/sp/scripts/inline-run-setup.ts +0 -722
  54. package/plugins/sp/scripts/pr-reviewing.mjs +0 -769
  55. package/plugins/sp/scripts/pr-reviewing.ts +0 -925
  56. package/plugins/sp/scripts/quality-gate.mjs +0 -179
  57. package/plugins/sp/scripts/quality-gate.ts +0 -217
  58. package/plugins/sp/scripts/script-contract-check.ts +0 -319
  59. package/plugins/sp/scripts/stage-registry-adapter.ts +0 -1533
  60. package/plugins/sp/scripts/surface-drift-inventory.ts +0 -929
  61. package/plugins/sp/scripts/task-evidence-precheck.ts +0 -181
  62. package/plugins/sp/scripts/task-size-precheck.ts +0 -175
  63. package/plugins/sp/scripts/transition-shim-check.ts +0 -238
  64. package/plugins/sp/scripts/validate-commands.ts +0 -689
  65. package/plugins/sp/scripts/validate-flag-contracts.ts +0 -878
  66. package/plugins/sp/scripts/verify-answer-lint.ts +0 -530
  67. package/plugins/sp/scripts/workflow-step-profile.mjs +0 -316
  68. package/plugins/sp/scripts/workflow-step-profile.ts +0 -456
  69. package/plugins/sp/scripts/wrapup-drift-probe.mjs +0 -190
  70. package/plugins/sp/scripts/wrapup-drift-probe.ts +0 -258
  71. package/plugins/sp/scripts/wrapup-steps.mjs +0 -444
  72. package/plugins/sp/scripts/wrapup-steps.ts +0 -552
@@ -1,319 +0,0 @@
1
- #!/usr/bin/env bun
2
- /**
3
- * script-contract-check — two-sided gate over plugins/sp script entrypoint contracts
4
- * (task 0600, feature I, ADR-065).
5
- *
6
- * Enforces superskill's standard plugin script contract across plugins/sp:
7
- * 1. A 'standard' entry must have a valid .mjs twin not older than its .ts source.
8
- * 2. A .mjs twin on disk must be registered under a 'standard' entry (never 'repo-only' or unlisted).
9
- * 3. Every script file under plugins/sp/scripts/ must have a manifest entry (two-sided).
10
- * 4. No shipped surface (commands/, skills/, agents/, README.md) may reference 'bun plugins/sp/scripts/'.
11
- *
12
- * Usage:
13
- * bun plugins/sp/scripts/script-contract-check.ts
14
- * [--manifest <path>] default: config/plugin-scripts.json
15
- * [--scripts-dir <path>] default: plugins/sp/scripts
16
- * [--plugin-dir <path>] default: plugins/sp
17
- *
18
- * Exit code: 0 on success, 1 on any violation.
19
- */
20
-
21
- import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
22
- import { join, resolve } from 'node:path';
23
-
24
- export type ScriptContractType = 'standard' | 'repo-only';
25
-
26
- export interface ScriptManifestEntry {
27
- rel: string;
28
- contract: ScriptContractType;
29
- twin?: string;
30
- }
31
-
32
- export interface ScriptManifest {
33
- schema_version?: number;
34
- description?: string;
35
- entries: ScriptManifestEntry[];
36
- }
37
-
38
- export interface Violation {
39
- kind:
40
- | 'missing_twin'
41
- | 'stale_twin'
42
- | 'unexpected_twin'
43
- | 'unregistered_script'
44
- | 'forbidden_invocation'
45
- | 'incomplete';
46
- target: string;
47
- message: string;
48
- }
49
-
50
- export function parseArgs(argv: string[]): {
51
- manifest: string;
52
- scriptsDir: string;
53
- pluginDir: string;
54
- cwd: string;
55
- } {
56
- let manifest = 'config/plugin-scripts.json';
57
- let scriptsDir = 'plugins/sp/scripts';
58
- let pluginDir = 'plugins/sp';
59
- for (let i = 0; i < argv.length; i++) {
60
- if (argv[i] === '--manifest') manifest = argv[++i] ?? manifest;
61
- else if (argv[i] === '--scripts-dir') scriptsDir = argv[++i] ?? scriptsDir;
62
- else if (argv[i] === '--plugin-dir') pluginDir = argv[++i] ?? pluginDir;
63
- }
64
- return { manifest, scriptsDir, pluginDir, cwd: process.cwd() };
65
- }
66
-
67
- export function loadManifest(path: string): { manifest: ScriptManifest | null; error: string | null } {
68
- if (!existsSync(path)) return { manifest: null, error: `manifest not found at ${path}` };
69
- try {
70
- const raw = readFileSync(path, 'utf8');
71
- const parsed = JSON.parse(raw) as ScriptManifest;
72
- if (!Array.isArray(parsed.entries)) {
73
- return { manifest: null, error: `${path}: missing "entries" array` };
74
- }
75
- return { manifest: parsed, error: null };
76
- } catch (err) {
77
- return { manifest: null, error: `malformed JSON at ${path}: ${String(err)}` };
78
- }
79
- }
80
-
81
- export function listDiskScripts(scriptsDir: string): { tsFiles: string[]; mjsFiles: string[] } {
82
- const tsFiles: string[] = [];
83
- const mjsFiles: string[] = [];
84
-
85
- function walk(dir: string, base: string): void {
86
- let entries: string[];
87
- try {
88
- entries = readdirSync(dir);
89
- } catch {
90
- return;
91
- }
92
- for (const entry of entries) {
93
- const fullPath = join(dir, entry);
94
- let st: ReturnType<typeof statSync>;
95
- try {
96
- st = statSync(fullPath);
97
- } catch {
98
- continue;
99
- }
100
- if (st.isDirectory()) {
101
- walk(fullPath, base ? `${base}/${entry}` : entry);
102
- } else if (st.isFile()) {
103
- const rel = base ? `${base}/${entry}` : entry;
104
- if (entry.endsWith('.ts')) {
105
- tsFiles.push(rel);
106
- } else if (entry.endsWith('.mjs')) {
107
- mjsFiles.push(rel);
108
- }
109
- }
110
- }
111
- }
112
-
113
- walk(scriptsDir, '');
114
- return { tsFiles: tsFiles.sort(), mjsFiles: mjsFiles.sort() };
115
- }
116
-
117
- export function scanShippedSurfaces(pluginDir: string): Array<{ file: string; line: number; content: string }> {
118
- const matches: Array<{ file: string; line: number; content: string }> = [];
119
- const forbiddenPattern = 'bun plugins/sp/scripts/';
120
-
121
- const searchDirs = ['commands', 'skills', 'agents'];
122
- const singleFiles = ['README.md'];
123
-
124
- function scanFile(filePath: string): void {
125
- if (!existsSync(filePath)) return;
126
- let text: string;
127
- try {
128
- text = readFileSync(filePath, 'utf8');
129
- } catch {
130
- return;
131
- }
132
- const lines = text.split('\n');
133
- for (let i = 0; i < lines.length; i++) {
134
- const line = lines[i] ?? '';
135
- if (line.includes(forbiddenPattern)) {
136
- matches.push({
137
- file: filePath,
138
- line: i + 1,
139
- content: line.trim(),
140
- });
141
- }
142
- }
143
- }
144
-
145
- function walk(dir: string): void {
146
- let entries: string[];
147
- try {
148
- entries = readdirSync(dir);
149
- } catch {
150
- return;
151
- }
152
- for (const entry of entries) {
153
- const fullPath = join(dir, entry);
154
- let st: ReturnType<typeof statSync>;
155
- try {
156
- st = statSync(fullPath);
157
- } catch {
158
- continue;
159
- }
160
- if (st.isDirectory()) {
161
- walk(fullPath);
162
- } else if (
163
- st.isFile() &&
164
- (entry.endsWith('.md') || entry.endsWith('.json') || entry.endsWith('.yaml') || entry.endsWith('.yml'))
165
- ) {
166
- scanFile(fullPath);
167
- }
168
- }
169
- }
170
-
171
- for (const d of searchDirs) {
172
- walk(join(pluginDir, d));
173
- }
174
- for (const f of singleFiles) {
175
- scanFile(join(pluginDir, f));
176
- }
177
-
178
- return matches;
179
- }
180
-
181
- export function validateContract(manifest: ScriptManifest, scriptsDir: string, pluginDir: string): Violation[] {
182
- const violations: Violation[] = [];
183
- const { tsFiles, mjsFiles } = listDiskScripts(scriptsDir);
184
-
185
- const manifestMap = new Map<string, ScriptManifestEntry>();
186
- for (const entry of manifest.entries) {
187
- if (!entry.rel || !entry.contract) {
188
- violations.push({
189
- kind: 'incomplete',
190
- target: entry.rel ?? '<missing>',
191
- message: `manifest entry missing required fields (rel, contract)`,
192
- });
193
- continue;
194
- }
195
- manifestMap.set(entry.rel, entry);
196
- }
197
-
198
- // Rule 1: standard entries must have valid .mjs twins not older than the .ts source.
199
- // mtime is only meaningful when a build genuinely ran: a `git worktree add` stamps
200
- // every checked-out file within the same millisecond, and the lexicographic write
201
- // order (`tool.mjs` < `tool.ts`) makes the twin spuriously "older" by <1ms. Tolerate
202
- // sub-second deltas so a fresh checkout is never flagged; real build staleness is
203
- // seconds-to-minutes, far beyond this window (task 0606 R1 eval-worktree blocker).
204
- const STALE_TWIN_TOLERANCE_MS = 1000;
205
- for (const entry of manifest.entries) {
206
- if (entry.rel && entry.contract === 'standard') {
207
- const expectedTwinRel = entry.twin ?? entry.rel.replace(/\.ts$/, '.mjs');
208
- const twinPath = join(scriptsDir, expectedTwinRel);
209
- const tsPath = join(scriptsDir, entry.rel);
210
-
211
- if (!existsSync(twinPath)) {
212
- violations.push({
213
- kind: 'missing_twin',
214
- target: entry.rel,
215
- message: `standard script ${entry.rel} is missing its .mjs twin (${expectedTwinRel})`,
216
- });
217
- } else if (existsSync(tsPath)) {
218
- const tsStat = statSync(tsPath);
219
- const twinStat = statSync(twinPath);
220
- if (twinStat.mtimeMs < tsStat.mtimeMs - STALE_TWIN_TOLERANCE_MS) {
221
- violations.push({
222
- kind: 'stale_twin',
223
- target: entry.rel,
224
- message: `standard script .mjs twin ${expectedTwinRel} is older than source ${entry.rel}`,
225
- });
226
- }
227
- }
228
- }
229
- }
230
-
231
- // Rule 2: committed .mjs files must belong to a 'standard' entry
232
- for (const mjsRel of mjsFiles) {
233
- const correspondingTsRel = mjsRel.replace(/\.mjs$/, '.ts');
234
- const entry = manifestMap.get(correspondingTsRel);
235
- if (!entry) {
236
- violations.push({
237
- kind: 'unexpected_twin',
238
- target: mjsRel,
239
- message: `.mjs twin ${mjsRel} exists on disk but has no manifest entry for ${correspondingTsRel}`,
240
- });
241
- } else if (entry.contract === 'repo-only') {
242
- violations.push({
243
- kind: 'unexpected_twin',
244
- target: mjsRel,
245
- message: `repo-only script ${correspondingTsRel} must not have a .mjs twin (${mjsRel})`,
246
- });
247
- }
248
- }
249
-
250
- // Rule 3: all .ts files on disk must have a manifest entry
251
- const diskTsSet = new Set(tsFiles);
252
- for (const tsRel of tsFiles) {
253
- if (!manifestMap.has(tsRel)) {
254
- violations.push({
255
- kind: 'unregistered_script',
256
- target: tsRel,
257
- message: `script ${tsRel} exists in scripts dir but is not registered in manifest`,
258
- });
259
- }
260
- }
261
-
262
- // Also verify manifest entries exist on disk
263
- for (const [rel] of manifestMap) {
264
- if (!diskTsSet.has(rel)) {
265
- violations.push({
266
- kind: 'unregistered_script',
267
- target: rel,
268
- message: `manifest entry ${rel} does not exist on disk in ${scriptsDir}`,
269
- });
270
- }
271
- }
272
-
273
- // Rule 4: scan shipped surfaces for forbidden invocation
274
- const forbiddenHits = scanShippedSurfaces(pluginDir);
275
- for (const hit of forbiddenHits) {
276
- violations.push({
277
- kind: 'forbidden_invocation',
278
- target: `${hit.file}:${hit.line}`,
279
- message: `shipped surface ${hit.file}:${hit.line} contains forbidden invocation 'bun plugins/sp/scripts/': ${hit.content}`,
280
- });
281
- }
282
-
283
- return violations;
284
- }
285
-
286
- export function run(argv: string[] = process.argv.slice(2)): number {
287
- const { manifest, scriptsDir, pluginDir, cwd } = parseArgs(argv);
288
- const manifestPath = resolve(cwd, manifest);
289
- const absScriptsDir = resolve(cwd, scriptsDir);
290
- const absPluginDir = resolve(cwd, pluginDir);
291
-
292
- const { manifest: parsed, error } = loadManifest(manifestPath);
293
- if (error || !parsed) {
294
- console.error(`script-contract-check: FAIL - ${error}`);
295
- return 1;
296
- }
297
-
298
- const violations = validateContract(parsed, absScriptsDir, absPluginDir);
299
- const ok = violations.length === 0;
300
-
301
- const standardCount = parsed.entries.filter((e) => e.contract === 'standard').length;
302
- const repoOnlyCount = parsed.entries.filter((e) => e.contract === 'repo-only').length;
303
-
304
- console.log(
305
- `script-contract-check: ${parsed.entries.length} script(s) baselined (${standardCount} standard, ${repoOnlyCount} repo-only), ` +
306
- `${violations.length} violation(s) — ${ok ? 'PASS' : 'FAIL'}`,
307
- );
308
-
309
- if (ok) return 0;
310
-
311
- for (const v of violations) {
312
- console.error(`script-contract-check: FAIL (${v.kind}) - ${v.message}`);
313
- }
314
- return 1;
315
- }
316
-
317
- if (import.meta.main) {
318
- process.exit(run());
319
- }