@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.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/index.js +114 -38
- package/package.json +1 -1
- package/plugins/generations/daily-article-gen/dist/index.js +24 -7
- package/plugins/generations/daily-article-gen/src/index.ts +36 -12
- package/plugins/generations/dailynews-gen/dist/index.js +19 -2
- package/plugins/generations/dailynews-gen/src/index.ts +7 -0
- package/plugins/generations/dailynews-gen/src/script-plan.ts +21 -3
- package/plugins/generations/episode-plan-gen/dist/index.js +55 -4
- package/plugins/generations/episode-plan-gen/src/index.ts +80 -2
- package/plugins/generations/image-gen/dist/index.js +122 -20
- package/plugins/generations/image-gen/src/bytes.ts +106 -18
- package/plugins/generations/image-gen/src/index.ts +46 -6
- package/plugins/generations/image-gen/src/job.ts +6 -0
- package/plugins/generations/image-gen/src/providers/minimax.ts +12 -4
- package/plugins/generations/image-gen/src/providers/types.ts +12 -1
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/scripts/daily-voice-style.zh.md +5 -5
- package/plugins/kk/scripts/itc-stages.ts +21 -3
- package/plugins/kk/scripts/kk-workflow-stages.ts +199 -7
- package/plugins/kk/scripts/topic-boundary.json +3 -12
- package/plugins/kk/skills/content-judge/SKILL.md +30 -0
- package/plugins/kk/skills/content-judge/references/workflow-integration.md +9 -2
- package/plugins/kk/skills/publish/SKILL.md +1 -1
- package/plugins/kk/workflows/judge-gated-publish-example.yaml +18 -10
- package/plugins/kk/workflows/kk-daily-ai-voice.yaml +39 -14
- package/plugins/kk/workflows/kk-itc.yaml +21 -8
- package/plugins/publishings/xhs-pub/dist/index.js +1 -1
- package/plugins/publishings/xhs-pub/src/automation-guard.ts +2 -2
- package/plugins/publishings/xhs-pub/src/index.ts +1 -1
- package/plugins/publishings/xhs-pub/src/profile-check.ts +2 -2
- package/plugins/sp/lib/env.ts +0 -46
- package/plugins/sp/lib/inline-run.generated.mjs +0 -1489
- package/plugins/sp/scripts/batch-preflight.mjs +0 -346
- package/plugins/sp/scripts/batch-preflight.ts +0 -459
- package/plugins/sp/scripts/daily-summary/daily-summary.mjs +0 -615
- package/plugins/sp/scripts/daily-summary/daily-summary.ts +0 -846
- package/plugins/sp/scripts/daily-summary/logger.ts +0 -28
- package/plugins/sp/scripts/dogfood-testing/detect-pipeline-driving.mjs +0 -223
- package/plugins/sp/scripts/dogfood-testing/detect-pipeline-driving.ts +0 -367
- package/plugins/sp/scripts/dogfood-testing/validate-report.mjs +0 -132
- package/plugins/sp/scripts/dogfood-testing/validate-report.ts +0 -169
- package/plugins/sp/scripts/feature-dev-precheck.mjs +0 -171
- package/plugins/sp/scripts/feature-dev-precheck.ts +0 -238
- package/plugins/sp/scripts/feature-sync-bounded.mjs +0 -285
- package/plugins/sp/scripts/feature-sync-bounded.ts +0 -478
- package/plugins/sp/scripts/feature-verification-steps.ts +0 -275
- package/plugins/sp/scripts/history-anatomy-cache.mjs +0 -902
- package/plugins/sp/scripts/history-anatomy-cache.ts +0 -1028
- package/plugins/sp/scripts/idea-handoff.mjs +0 -22
- package/plugins/sp/scripts/idea-handoff.ts +0 -44
- package/plugins/sp/scripts/inline-pipeline-parity-check.ts +0 -185
- package/plugins/sp/scripts/inline-run-setup.ts +0 -722
- package/plugins/sp/scripts/pr-reviewing.mjs +0 -769
- package/plugins/sp/scripts/pr-reviewing.ts +0 -925
- package/plugins/sp/scripts/quality-gate.mjs +0 -179
- package/plugins/sp/scripts/quality-gate.ts +0 -217
- package/plugins/sp/scripts/script-contract-check.ts +0 -319
- package/plugins/sp/scripts/stage-registry-adapter.ts +0 -1533
- package/plugins/sp/scripts/surface-drift-inventory.ts +0 -929
- package/plugins/sp/scripts/task-evidence-precheck.ts +0 -181
- package/plugins/sp/scripts/task-size-precheck.ts +0 -175
- package/plugins/sp/scripts/transition-shim-check.ts +0 -238
- package/plugins/sp/scripts/validate-commands.ts +0 -689
- package/plugins/sp/scripts/validate-flag-contracts.ts +0 -878
- package/plugins/sp/scripts/verify-answer-lint.ts +0 -530
- package/plugins/sp/scripts/workflow-step-profile.mjs +0 -316
- package/plugins/sp/scripts/workflow-step-profile.ts +0 -456
- package/plugins/sp/scripts/wrapup-drift-probe.mjs +0 -190
- package/plugins/sp/scripts/wrapup-drift-probe.ts +0 -258
- package/plugins/sp/scripts/wrapup-steps.mjs +0 -444
- 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
|
-
}
|