fix: quiet skill command normalization logs
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
|||||||
} from "@mariozechner/pi-coding-agent";
|
} from "@mariozechner/pi-coding-agent";
|
||||||
|
|
||||||
import type { ClawdbotConfig } from "../../config/config.js";
|
import type { ClawdbotConfig } from "../../config/config.js";
|
||||||
|
import { createSubsystemLogger } from "../../logging.js";
|
||||||
import { CONFIG_DIR, resolveUserPath } from "../../utils.js";
|
import { CONFIG_DIR, resolveUserPath } from "../../utils.js";
|
||||||
import { resolveBundledSkillsDir } from "./bundled-dir.js";
|
import { resolveBundledSkillsDir } from "./bundled-dir.js";
|
||||||
import { shouldIncludeSkill } from "./config.js";
|
import { shouldIncludeSkill } from "./config.js";
|
||||||
@@ -26,6 +27,14 @@ import type {
|
|||||||
} from "./types.js";
|
} from "./types.js";
|
||||||
|
|
||||||
const fsp = fs.promises;
|
const fsp = fs.promises;
|
||||||
|
const skillsLogger = createSubsystemLogger("skills");
|
||||||
|
const skillCommandDebugOnce = new Set<string>();
|
||||||
|
|
||||||
|
function debugSkillCommandOnce(messageKey: string, message: string, meta?: Record<string, unknown>) {
|
||||||
|
if (skillCommandDebugOnce.has(messageKey)) return;
|
||||||
|
skillCommandDebugOnce.add(messageKey);
|
||||||
|
skillsLogger.debug(message, meta);
|
||||||
|
}
|
||||||
|
|
||||||
function filterSkillEntries(
|
function filterSkillEntries(
|
||||||
entries: SkillEntry[],
|
entries: SkillEntry[],
|
||||||
@@ -324,12 +333,18 @@ export function buildWorkspaceSkillCommandSpecs(
|
|||||||
const rawName = entry.skill.name;
|
const rawName = entry.skill.name;
|
||||||
const base = sanitizeSkillCommandName(rawName);
|
const base = sanitizeSkillCommandName(rawName);
|
||||||
if (base !== rawName) {
|
if (base !== rawName) {
|
||||||
console.warn(`[skills] Sanitized skill command name "${rawName}" to "/${base}".`);
|
debugSkillCommandOnce(
|
||||||
|
`sanitize:${rawName}:${base}`,
|
||||||
|
`Sanitized skill command name "${rawName}" to "/${base}".`,
|
||||||
|
{ rawName, sanitized: `/${base}` },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const unique = resolveUniqueSkillCommandName(base, used);
|
const unique = resolveUniqueSkillCommandName(base, used);
|
||||||
if (unique !== base) {
|
if (unique !== base) {
|
||||||
console.warn(
|
debugSkillCommandOnce(
|
||||||
`[skills] De-duplicated skill command name for "${rawName}" to "/${unique}".`,
|
`dedupe:${rawName}:${unique}`,
|
||||||
|
`De-duplicated skill command name for "${rawName}" to "/${unique}".`,
|
||||||
|
{ rawName, deduped: `/${unique}` },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
used.add(unique.toLowerCase());
|
used.add(unique.toLowerCase());
|
||||||
|
|||||||
Reference in New Issue
Block a user