@canonry/canonry 4.167.1 → 4.168.0

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.
@@ -56963,7 +56963,85 @@ function readInstalledManifest(skillDir) {
56963
56963
  return null;
56964
56964
  }
56965
56965
  }
56966
- var AGENT_CHECKS = [skillsInstalledCheck, skillsCurrentCheck];
56966
+ var SKILL_DESCRIPTION_MAX = 1024;
56967
+ var SKILL_DESCRIPTION_MIN = 80;
56968
+ var skillsTriggerSurfaceCheck = {
56969
+ id: "agent.skills.trigger-surface",
56970
+ category: CheckCategories.agent,
56971
+ scope: CheckScopes.global,
56972
+ title: "Agent skill trigger surface",
56973
+ run: (ctx) => {
56974
+ const bundled = ctx.bundledSkills;
56975
+ if (!bundled || bundled.length === 0) {
56976
+ return {
56977
+ status: CheckStatuses.skipped,
56978
+ code: "agent.skills.bundle-unavailable",
56979
+ summary: "This deployment does not ship bundled skills, so there is no trigger surface to measure.",
56980
+ remediation: null,
56981
+ details: {}
56982
+ };
56983
+ }
56984
+ const skills = bundled.map((skill) => {
56985
+ const description = skill.description ?? "";
56986
+ return {
56987
+ name: skill.name,
56988
+ length: description.length,
56989
+ // The CLI binary name is the single likeliest token to appear in a
56990
+ // request that should load the skill, and the one most easily left out
56991
+ // because the author is thinking in product names.
56992
+ namesCli: /\bcnry\b|\bcanonry\b/i.test(description),
56993
+ missing: skill.description === void 0
56994
+ };
56995
+ });
56996
+ const totalLength = skills.reduce((sum, s) => sum + s.length, 0);
56997
+ const details = { skills, totalDescriptionLength: totalLength };
56998
+ const missing = skills.filter((s) => s.missing).map((s) => s.name);
56999
+ if (missing.length > 0) {
57000
+ return {
57001
+ status: CheckStatuses.fail,
57002
+ code: "agent.skills.description-missing",
57003
+ summary: `No description frontmatter on: ${missing.join(", ")}. Without it the skill can never be selected.`,
57004
+ remediation: "Add a `description:` to each SKILL.md saying what the skill does and when to load it.",
57005
+ details
57006
+ };
57007
+ }
57008
+ const tooLong = skills.filter((s) => s.length > SKILL_DESCRIPTION_MAX).map((s) => s.name);
57009
+ if (tooLong.length > 0) {
57010
+ return {
57011
+ status: CheckStatuses.fail,
57012
+ code: "agent.skills.description-too-long",
57013
+ summary: `Description over the ${SKILL_DESCRIPTION_MAX}-character limit on: ${tooLong.join(", ")}.`,
57014
+ remediation: "Shorten it. Detail belongs in the skill body; the description is only the trigger.",
57015
+ details
57016
+ };
57017
+ }
57018
+ const tooShort = skills.filter((s) => s.length < SKILL_DESCRIPTION_MIN).map((s) => s.name);
57019
+ const unnamed = skills.filter((s) => !s.namesCli).map((s) => s.name);
57020
+ const weak = [.../* @__PURE__ */ new Set([...tooShort, ...unnamed])];
57021
+ if (weak.length > 0) {
57022
+ const reasons = [];
57023
+ if (tooShort.length > 0) reasons.push(`under ${SKILL_DESCRIPTION_MIN} characters (${tooShort.join(", ")})`);
57024
+ if (unnamed.length > 0) reasons.push(`never names the CLI (${unnamed.join(", ")})`);
57025
+ return {
57026
+ status: CheckStatuses.warn,
57027
+ code: "agent.skills.description-weak",
57028
+ summary: `A skill description is the whole trigger surface, and one is ${reasons.join("; ")}.`,
57029
+ remediation: "Name the commands and phrases an operator actually types, `cnry` included, and say when to load the skill.",
57030
+ details
57031
+ };
57032
+ }
57033
+ return {
57034
+ status: CheckStatuses.ok,
57035
+ code: "agent.skills.trigger-surface-ok",
57036
+ // Deliberately not "the skill will load": nothing forces a model to load
57037
+ // one. This measures the surface, never the outcome.
57038
+ summary: `${skills.length} skill descriptions look loadable (${totalLength} chars total). This measures the trigger surface, not whether an agent actually loads it.`,
57039
+ remediation: null,
57040
+ details
57041
+ };
57042
+ }
57043
+ };
57044
+ var AGENT_CHECKS = [skillsInstalledCheck, skillsCurrentCheck, skillsTriggerSurfaceCheck];
56967
57045
 
56968
57046
  // ../api-routes/src/doctor/checks/backlinks.ts
56969
57047
  import { and as and41, eq as eq49 } from "drizzle-orm";