Phase 12: maxSkills soft warn — SPEC §15.
Optional maxSkills setting sets the warn threshold; when unset, re-injecting more than three tracked skills emits a one-time UI warning without blocking delivery. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -96,6 +96,29 @@ export function enqueueDeferredReinjectFromCompact(
|
||||
);
|
||||
}
|
||||
|
||||
/** Warn when re-injecting many skills; unlimited by default with soft warn above 3 (SPEC §15). */
|
||||
export function maybeWarnManySkills(
|
||||
skillCount: number,
|
||||
settings: SkillReinjectSettings,
|
||||
ctx?: ExtensionContext,
|
||||
): void {
|
||||
if (skillCount <= 0) {
|
||||
return;
|
||||
}
|
||||
const threshold = settings.maxSkills ?? 3;
|
||||
if (skillCount <= threshold) {
|
||||
return;
|
||||
}
|
||||
if (settings.maxSkills !== undefined) {
|
||||
notifyWarning(
|
||||
ctx,
|
||||
`skill-reinject: re-injecting ${skillCount} skills (maxSkills warn threshold: ${settings.maxSkills})`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
notifyWarning(ctx, `skill-reinject: re-injecting ${skillCount} tracked skills (soft warn above 3)`);
|
||||
}
|
||||
|
||||
/** Expanded skill-block messages in queue order (SPEC §5.3). */
|
||||
export function buildReinjectBlocks(
|
||||
skillNames: readonly string[],
|
||||
@@ -104,6 +127,7 @@ export function buildReinjectBlocks(
|
||||
registeredSkills: readonly Pick<Skill, "name" | "filePath" | "baseDir">[],
|
||||
ctx?: ExtensionContext,
|
||||
): string[] {
|
||||
maybeWarnManySkills(skillNames.length, settings, ctx);
|
||||
const registeredByName = registeredSkillsByName(registeredSkills, ctx);
|
||||
const blocks: string[] = [];
|
||||
for (const name of skillNames) {
|
||||
|
||||
Reference in New Issue
Block a user