agent-skills-standard 2.0.0 → 2.1.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.
- package/README.md +72 -102
- package/dist/index.js +577 -64
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -58,7 +58,10 @@ class FeedbackCommand {
|
|
|
58
58
|
skillInstruction,
|
|
59
59
|
actualAction,
|
|
60
60
|
decisionReason,
|
|
61
|
-
loadedSkills
|
|
61
|
+
loadedSkills,
|
|
62
|
+
rootCause,
|
|
63
|
+
userIntent,
|
|
64
|
+
skillGap
|
|
62
65
|
} = options;
|
|
63
66
|
if (!skill || !issue) {
|
|
64
67
|
const answers = await inquirer.prompt([
|
|
@@ -117,6 +120,32 @@ class FeedbackCommand {
|
|
|
117
120
|
name: "loadedSkills",
|
|
118
121
|
message: "All active skills (optional)",
|
|
119
122
|
when: !loadedSkills
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
type: "list",
|
|
126
|
+
name: "rootCause",
|
|
127
|
+
message: "Root cause of the violation (optional)",
|
|
128
|
+
when: !rootCause,
|
|
129
|
+
choices: [
|
|
130
|
+
{ name: "Skip", value: "" },
|
|
131
|
+
"AMBIGUOUS_RULE",
|
|
132
|
+
"MISSING_COVERAGE",
|
|
133
|
+
"OUTDATED_GUIDANCE",
|
|
134
|
+
"COMPETING_RULES",
|
|
135
|
+
"PATTERN_MISMATCH"
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
type: "input",
|
|
140
|
+
name: "userIntent",
|
|
141
|
+
message: "What was the user trying to achieve? (optional)",
|
|
142
|
+
when: !userIntent
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
type: "input",
|
|
146
|
+
name: "skillGap",
|
|
147
|
+
message: "What change to the skill would prevent this? (optional)",
|
|
148
|
+
when: !skillGap
|
|
120
149
|
}
|
|
121
150
|
]);
|
|
122
151
|
skill = skill || answers.skill;
|
|
@@ -128,6 +157,9 @@ class FeedbackCommand {
|
|
|
128
157
|
actualAction = actualAction || answers.actualAction;
|
|
129
158
|
decisionReason = decisionReason || answers.decisionReason;
|
|
130
159
|
loadedSkills = loadedSkills || answers.loadedSkills;
|
|
160
|
+
rootCause = rootCause || answers.rootCause || void 0;
|
|
161
|
+
userIntent = userIntent || answers.userIntent;
|
|
162
|
+
skillGap = skillGap || answers.skillGap;
|
|
131
163
|
await this.submit({
|
|
132
164
|
skill,
|
|
133
165
|
issue,
|
|
@@ -137,7 +169,10 @@ class FeedbackCommand {
|
|
|
137
169
|
skillInstruction,
|
|
138
170
|
actualAction,
|
|
139
171
|
decisionReason,
|
|
140
|
-
loadedSkills
|
|
172
|
+
loadedSkills,
|
|
173
|
+
rootCause,
|
|
174
|
+
userIntent,
|
|
175
|
+
skillGap
|
|
141
176
|
});
|
|
142
177
|
} else {
|
|
143
178
|
await this.submit({
|
|
@@ -149,7 +184,10 @@ class FeedbackCommand {
|
|
|
149
184
|
skillInstruction,
|
|
150
185
|
actualAction,
|
|
151
186
|
decisionReason,
|
|
152
|
-
loadedSkills
|
|
187
|
+
loadedSkills,
|
|
188
|
+
rootCause,
|
|
189
|
+
userIntent,
|
|
190
|
+
skillGap
|
|
153
191
|
});
|
|
154
192
|
}
|
|
155
193
|
}
|
|
@@ -504,7 +542,8 @@ const DEFAULT_WORKFLOWS = [
|
|
|
504
542
|
"code-review",
|
|
505
543
|
"codebase-review",
|
|
506
544
|
"plan-feature",
|
|
507
|
-
"skill-benchmark"
|
|
545
|
+
"skill-benchmark",
|
|
546
|
+
"pentest"
|
|
508
547
|
];
|
|
509
548
|
const getAgentDefinition = (id) => {
|
|
510
549
|
switch (id) {
|
|
@@ -516,7 +555,9 @@ const getAgentDefinition = (id) => {
|
|
|
516
555
|
ruleFile: ".cursor/rules",
|
|
517
556
|
ruleExtension: ".mdc",
|
|
518
557
|
frontmatterStyle: "cursor",
|
|
519
|
-
detectionFiles: [".cursor", ".cursorrules"]
|
|
558
|
+
detectionFiles: [".cursor", ".cursorrules"],
|
|
559
|
+
workflowFormat: "none",
|
|
560
|
+
workflowPath: ""
|
|
520
561
|
};
|
|
521
562
|
case Agent.Trae:
|
|
522
563
|
return {
|
|
@@ -526,7 +567,9 @@ const getAgentDefinition = (id) => {
|
|
|
526
567
|
ruleFile: ".trae/rules",
|
|
527
568
|
ruleExtension: ".mdc",
|
|
528
569
|
frontmatterStyle: "cursor",
|
|
529
|
-
detectionFiles: [".trae"]
|
|
570
|
+
detectionFiles: [".trae"],
|
|
571
|
+
workflowFormat: "none",
|
|
572
|
+
workflowPath: ""
|
|
530
573
|
};
|
|
531
574
|
case Agent.Claude:
|
|
532
575
|
return {
|
|
@@ -534,11 +577,12 @@ const getAgentDefinition = (id) => {
|
|
|
534
577
|
name: "Claude Code",
|
|
535
578
|
path: ".claude/skills",
|
|
536
579
|
ruleFile: ".",
|
|
537
|
-
// Root directory for CLAUDE.md
|
|
538
580
|
ruleExtension: ".md",
|
|
539
581
|
ruleFileName: "CLAUDE.md",
|
|
540
582
|
frontmatterStyle: "none",
|
|
541
|
-
detectionFiles: [".claude", "CLAUDE.md"]
|
|
583
|
+
detectionFiles: [".claude", "CLAUDE.md"],
|
|
584
|
+
workflowFormat: "command",
|
|
585
|
+
workflowPath: ".claude/commands"
|
|
542
586
|
};
|
|
543
587
|
case Agent.Copilot:
|
|
544
588
|
return {
|
|
@@ -548,7 +592,9 @@ const getAgentDefinition = (id) => {
|
|
|
548
592
|
ruleFile: ".github/instructions",
|
|
549
593
|
ruleExtension: ".instructions.md",
|
|
550
594
|
frontmatterStyle: "copilot",
|
|
551
|
-
detectionFiles: [".github"]
|
|
595
|
+
detectionFiles: [".github"],
|
|
596
|
+
workflowFormat: "prompt",
|
|
597
|
+
workflowPath: ".github/prompts"
|
|
552
598
|
};
|
|
553
599
|
case Agent.Antigravity:
|
|
554
600
|
return {
|
|
@@ -558,7 +604,9 @@ const getAgentDefinition = (id) => {
|
|
|
558
604
|
ruleFile: ".agent/rules",
|
|
559
605
|
ruleExtension: ".md",
|
|
560
606
|
frontmatterStyle: "cursor",
|
|
561
|
-
detectionFiles: [".agent"]
|
|
607
|
+
detectionFiles: [".agent"],
|
|
608
|
+
workflowFormat: "native",
|
|
609
|
+
workflowPath: ".agent/workflows"
|
|
562
610
|
};
|
|
563
611
|
case Agent.OpenAI:
|
|
564
612
|
return {
|
|
@@ -568,7 +616,9 @@ const getAgentDefinition = (id) => {
|
|
|
568
616
|
ruleFile: ".codex/rules",
|
|
569
617
|
ruleExtension: ".md",
|
|
570
618
|
frontmatterStyle: "cursor",
|
|
571
|
-
detectionFiles: [".codex"]
|
|
619
|
+
detectionFiles: [".codex"],
|
|
620
|
+
workflowFormat: "none",
|
|
621
|
+
workflowPath: ""
|
|
572
622
|
};
|
|
573
623
|
case Agent.OpenCode:
|
|
574
624
|
return {
|
|
@@ -578,7 +628,9 @@ const getAgentDefinition = (id) => {
|
|
|
578
628
|
ruleFile: ".opencode/rules",
|
|
579
629
|
ruleExtension: ".md",
|
|
580
630
|
frontmatterStyle: "cursor",
|
|
581
|
-
detectionFiles: [".opencode"]
|
|
631
|
+
detectionFiles: [".opencode"],
|
|
632
|
+
workflowFormat: "none",
|
|
633
|
+
workflowPath: ""
|
|
582
634
|
};
|
|
583
635
|
case Agent.Gemini:
|
|
584
636
|
return {
|
|
@@ -588,7 +640,9 @@ const getAgentDefinition = (id) => {
|
|
|
588
640
|
ruleFile: ".gemini/rules",
|
|
589
641
|
ruleExtension: ".md",
|
|
590
642
|
frontmatterStyle: "cursor",
|
|
591
|
-
detectionFiles: [".gemini"]
|
|
643
|
+
detectionFiles: [".gemini"],
|
|
644
|
+
workflowFormat: "toml",
|
|
645
|
+
workflowPath: ".gemini/commands"
|
|
592
646
|
};
|
|
593
647
|
case Agent.Roo:
|
|
594
648
|
return {
|
|
@@ -598,7 +652,9 @@ const getAgentDefinition = (id) => {
|
|
|
598
652
|
ruleFile: ".roo/rules",
|
|
599
653
|
ruleExtension: ".md",
|
|
600
654
|
frontmatterStyle: "cursor",
|
|
601
|
-
detectionFiles: [".roo"]
|
|
655
|
+
detectionFiles: [".roo"],
|
|
656
|
+
workflowFormat: "none",
|
|
657
|
+
workflowPath: ""
|
|
602
658
|
};
|
|
603
659
|
case Agent.Windsurf:
|
|
604
660
|
return {
|
|
@@ -608,7 +664,9 @@ const getAgentDefinition = (id) => {
|
|
|
608
664
|
ruleFile: ".windsurf/rules",
|
|
609
665
|
ruleExtension: ".md",
|
|
610
666
|
frontmatterStyle: "cursor",
|
|
611
|
-
detectionFiles: [".windsurf", ".windsurfrules"]
|
|
667
|
+
detectionFiles: [".windsurf", ".windsurfrules"],
|
|
668
|
+
workflowFormat: "none",
|
|
669
|
+
workflowPath: ""
|
|
612
670
|
};
|
|
613
671
|
case Agent.Kiro:
|
|
614
672
|
return {
|
|
@@ -616,10 +674,11 @@ const getAgentDefinition = (id) => {
|
|
|
616
674
|
name: "Kiro",
|
|
617
675
|
path: ".kiro/skills",
|
|
618
676
|
ruleFile: ".kiro/rules",
|
|
619
|
-
// Changed from steering to match AGENT_CONFIGS
|
|
620
677
|
ruleExtension: ".md",
|
|
621
678
|
frontmatterStyle: "cursor",
|
|
622
|
-
detectionFiles: [".kiro"]
|
|
679
|
+
detectionFiles: [".kiro"],
|
|
680
|
+
workflowFormat: "native",
|
|
681
|
+
workflowPath: ".agent/workflows"
|
|
623
682
|
};
|
|
624
683
|
}
|
|
625
684
|
};
|
|
@@ -1162,6 +1221,7 @@ class DetectionService {
|
|
|
1162
1221
|
path.join(dir, entry.name),
|
|
1163
1222
|
"utf8"
|
|
1164
1223
|
);
|
|
1224
|
+
gradleRegex.lastIndex = 0;
|
|
1165
1225
|
let match;
|
|
1166
1226
|
while ((match = gradleRegex.exec(content)) !== null) {
|
|
1167
1227
|
set.add(match[1]);
|
|
@@ -1600,17 +1660,33 @@ class SkillService {
|
|
|
1600
1660
|
const rule = detectRules.find((x) => x.id === skillName);
|
|
1601
1661
|
let status = "no-rule";
|
|
1602
1662
|
if (rule) {
|
|
1603
|
-
const
|
|
1604
|
-
|
|
1605
|
-
(d) => d.toLowerCase().includes(p.toLowerCase())
|
|
1606
|
-
)
|
|
1607
|
-
);
|
|
1663
|
+
const depsArray = Array.from(projectDeps);
|
|
1664
|
+
const isPresent = this.hasDependency(rule.packages, depsArray);
|
|
1608
1665
|
status = isPresent ? "detected" : "not-detected";
|
|
1609
1666
|
}
|
|
1610
1667
|
return { name: skillName, status };
|
|
1611
1668
|
});
|
|
1612
1669
|
return skills;
|
|
1613
1670
|
}
|
|
1671
|
+
/**
|
|
1672
|
+
* Checks if ANY of the required dependencies are found in the project.
|
|
1673
|
+
* Uses the same word-boundary matching logic as ConfigService.hasDependency().
|
|
1674
|
+
*/
|
|
1675
|
+
hasDependency(packages, projectDeps) {
|
|
1676
|
+
if (packages.length === 0) return true;
|
|
1677
|
+
return projectDeps.some(
|
|
1678
|
+
(d) => packages.some((pkg2) => {
|
|
1679
|
+
const depLower = d.toLowerCase();
|
|
1680
|
+
const pkgLower = pkg2.toLowerCase();
|
|
1681
|
+
if (depLower === pkgLower) return true;
|
|
1682
|
+
if (pkg2.length <= 3) return false;
|
|
1683
|
+
if (depLower.includes("/") && depLower.split("/").pop() === pkgLower)
|
|
1684
|
+
return true;
|
|
1685
|
+
const parts = depLower.split(/[-/_]/);
|
|
1686
|
+
return parts.includes(pkgLower);
|
|
1687
|
+
})
|
|
1688
|
+
);
|
|
1689
|
+
}
|
|
1614
1690
|
}
|
|
1615
1691
|
class ListSkillsCommand {
|
|
1616
1692
|
configService;
|
|
@@ -1725,7 +1801,7 @@ class AgentBridgeService {
|
|
|
1725
1801
|
"",
|
|
1726
1802
|
"## Self-Learning Protocol",
|
|
1727
1803
|
"",
|
|
1728
|
-
`At the end of any multi-step task with user corrections, load and run **[common/session-retrospective](${prefix}common/session-retrospective/SKILL.md)** to capture skill gaps and prevent repeat rework.`,
|
|
1804
|
+
`At the end of any multi-step task with user corrections, load and run **[common/common-session-retrospective](${prefix}common/common-session-retrospective/SKILL.md)** to capture skill gaps and prevent repeat rework.`,
|
|
1729
1805
|
""
|
|
1730
1806
|
].join("\n");
|
|
1731
1807
|
let detected = false;
|
|
@@ -1762,11 +1838,42 @@ applyTo: '**/*'
|
|
|
1762
1838
|
`;
|
|
1763
1839
|
break;
|
|
1764
1840
|
}
|
|
1841
|
+
const isClaude = agentId === Agent.Claude;
|
|
1842
|
+
if (isClaude) {
|
|
1843
|
+
const claudeProtocol = [
|
|
1844
|
+
"",
|
|
1845
|
+
"## Agent Protocol",
|
|
1846
|
+
"",
|
|
1847
|
+
"See `AGENTS.md` for the Zero-Trust skill loading protocol (applies to all AI agents).",
|
|
1848
|
+
"",
|
|
1849
|
+
"## Self-Learning Protocol",
|
|
1850
|
+
"",
|
|
1851
|
+
`At the end of any multi-step task with user corrections, load and run **[common/common-session-retrospective](${prefix}common/common-session-retrospective/SKILL.md)** to capture skill gaps and prevent repeat rework.`,
|
|
1852
|
+
""
|
|
1853
|
+
].join("\n");
|
|
1854
|
+
const claudePath = path.join(rootDir, "CLAUDE.md");
|
|
1855
|
+
if (await fs.pathExists(claudePath)) {
|
|
1856
|
+
const existingContent = await fs.readFile(claudePath, "utf8");
|
|
1857
|
+
if (existingContent && !existingContent.includes("## Agent Protocol")) {
|
|
1858
|
+
await fs.appendFile(claudePath, claudeProtocol);
|
|
1859
|
+
}
|
|
1860
|
+
} else {
|
|
1861
|
+
await fs.outputFile(claudePath, claudeProtocol.trimStart());
|
|
1862
|
+
}
|
|
1863
|
+
continue;
|
|
1864
|
+
}
|
|
1765
1865
|
content += commonBody;
|
|
1766
1866
|
await fs.outputFile(ruleFilePath, content);
|
|
1767
1867
|
}
|
|
1768
1868
|
}
|
|
1769
1869
|
}
|
|
1870
|
+
const INJECTION_PATTERNS = [
|
|
1871
|
+
/ignore\s+(?:all\s+|previous\s+|prior\s+)*(?:instructions?|rules?|guidance)/gi,
|
|
1872
|
+
/you\s+(?:must|should|shall|will)\s+(?:now|immediately)\b/gi,
|
|
1873
|
+
/^(?:system|user|assistant)\s*:/gim,
|
|
1874
|
+
/(?:^|\n)\s*-{3,}\s*(?:\n|$)/g,
|
|
1875
|
+
/<(?:script|iframe|style)[^>]*\s*>[\s\S]*?<\/(?:script|iframe|style)[^>]*\s*>/gi
|
|
1876
|
+
];
|
|
1770
1877
|
class IndexGeneratorService {
|
|
1771
1878
|
/**
|
|
1772
1879
|
* Loads foundational composite rules from the registry's metadata.json.
|
|
@@ -1886,6 +1993,216 @@ class IndexGeneratorService {
|
|
|
1886
1993
|
${entries.join("\n")}
|
|
1887
1994
|
`;
|
|
1888
1995
|
}
|
|
1996
|
+
/**
|
|
1997
|
+
* Loads file routing rules from the registry's metadata.json.
|
|
1998
|
+
* Maps file extensions to category arrays for router table generation.
|
|
1999
|
+
*/
|
|
2000
|
+
async loadFileRouting(baseDir) {
|
|
2001
|
+
try {
|
|
2002
|
+
const metaPath = path.join(baseDir, "metadata.json");
|
|
2003
|
+
const raw = await fs.readFile(metaPath, "utf8");
|
|
2004
|
+
const parsed = JSON.parse(raw);
|
|
2005
|
+
return parsed.file_routing ?? {};
|
|
2006
|
+
} catch {
|
|
2007
|
+
return {};
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
/**
|
|
2011
|
+
* Loads broad glob patterns and base language skill mappings from metadata.json.
|
|
2012
|
+
* Used to classify triggers into tiers (file match vs keyword match).
|
|
2013
|
+
*/
|
|
2014
|
+
async loadTierConfig(baseDir) {
|
|
2015
|
+
try {
|
|
2016
|
+
const metaPath = path.join(baseDir, "metadata.json");
|
|
2017
|
+
const raw = await fs.readFile(metaPath, "utf8");
|
|
2018
|
+
const parsed = JSON.parse(raw);
|
|
2019
|
+
return {
|
|
2020
|
+
broadGlobs: parsed.broad_globs ?? [],
|
|
2021
|
+
baseSkills: parsed.base_language_skills ?? {}
|
|
2022
|
+
};
|
|
2023
|
+
} catch {
|
|
2024
|
+
return { broadGlobs: [], baseSkills: {} };
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
/**
|
|
2028
|
+
* Generates a tiered per-category _INDEX.md with two sections:
|
|
2029
|
+
* - **File Match**: Skills with specific path patterns (auto-match when editing a file)
|
|
2030
|
+
* - **Keyword Match**: Skills triggered by user intent (only when user mentions the concept)
|
|
2031
|
+
*
|
|
2032
|
+
* Broad globs (e.g., **\/*.ts) are stripped from non-base skills and those skills
|
|
2033
|
+
* are moved to Keyword Match only. This prevents 30+ skills from matching a single file.
|
|
2034
|
+
*/
|
|
2035
|
+
async generateCategoryIndex(baseDir, category) {
|
|
2036
|
+
const categoryPath = path.join(baseDir, category);
|
|
2037
|
+
if (!await fs.pathExists(categoryPath)) return "";
|
|
2038
|
+
const { broadGlobs, baseSkills } = await this.loadTierConfig(baseDir);
|
|
2039
|
+
const baseSkillForCategory = baseSkills[category];
|
|
2040
|
+
const skills = await fs.readdir(categoryPath);
|
|
2041
|
+
skills.sort();
|
|
2042
|
+
const fileMatchRows = [];
|
|
2043
|
+
const keywordMatchRows = [];
|
|
2044
|
+
for (const skill of skills) {
|
|
2045
|
+
if (skill.startsWith(".") || skill === "_INDEX.md") continue;
|
|
2046
|
+
const skillPath = path.join(categoryPath, skill, "SKILL.md");
|
|
2047
|
+
if (!await fs.pathExists(skillPath)) continue;
|
|
2048
|
+
const metadata = await this.parseSkill(skillPath);
|
|
2049
|
+
if (!metadata) continue;
|
|
2050
|
+
const isBaseSkill = skill === baseSkillForCategory;
|
|
2051
|
+
const allFiles = metadata.triggers.files || [];
|
|
2052
|
+
const kwTrigs = (metadata.triggers.keywords || []).join(", ") || "—";
|
|
2053
|
+
const prefix = metadata.priority.startsWith("P0") ? "**" : "";
|
|
2054
|
+
const suffix = prefix ? "**" : "";
|
|
2055
|
+
const specificFiles = allFiles.filter((f) => !broadGlobs.includes(f));
|
|
2056
|
+
const hasBroadGlob = allFiles.some((f) => broadGlobs.includes(f));
|
|
2057
|
+
if (isBaseSkill || specificFiles.length > 0 && !hasBroadGlob) {
|
|
2058
|
+
const displayFiles = isBaseSkill ? allFiles.map((f) => `\`${f}\``).join(", ") : specificFiles.map((f) => `\`${f}\``).join(", ");
|
|
2059
|
+
fileMatchRows.push(
|
|
2060
|
+
`| ${prefix}${skill}${suffix} | ${displayFiles || "—"} | ${kwTrigs} |`
|
|
2061
|
+
);
|
|
2062
|
+
} else if (specificFiles.length > 0 && hasBroadGlob) {
|
|
2063
|
+
const displayFiles = specificFiles.map((f) => `\`${f}\``).join(", ");
|
|
2064
|
+
fileMatchRows.push(
|
|
2065
|
+
`| ${prefix}${skill}${suffix} | ${displayFiles} | ${kwTrigs} |`
|
|
2066
|
+
);
|
|
2067
|
+
} else {
|
|
2068
|
+
keywordMatchRows.push(`| ${prefix}${skill}${suffix} | ${kwTrigs} |`);
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
if (fileMatchRows.length === 0 && keywordMatchRows.length === 0) return "";
|
|
2072
|
+
const lines = [
|
|
2073
|
+
`<!-- AUTO-GENERATED from SKILL.md frontmatters — do not edit manually -->`,
|
|
2074
|
+
`# ${category} Skills Index`,
|
|
2075
|
+
""
|
|
2076
|
+
];
|
|
2077
|
+
if (fileMatchRows.length > 0) {
|
|
2078
|
+
lines.push(
|
|
2079
|
+
`## File Match (auto-check against the file you are editing)`,
|
|
2080
|
+
"",
|
|
2081
|
+
"| Skill | File pattern | Keywords |",
|
|
2082
|
+
"| ----- | ------------ | -------- |",
|
|
2083
|
+
...fileMatchRows,
|
|
2084
|
+
""
|
|
2085
|
+
);
|
|
2086
|
+
}
|
|
2087
|
+
if (keywordMatchRows.length > 0) {
|
|
2088
|
+
lines.push(
|
|
2089
|
+
`## Keyword Match (only when user's request mentions these)`,
|
|
2090
|
+
"",
|
|
2091
|
+
"| Skill | Match when user mentions |",
|
|
2092
|
+
"| ----- | ----------------------- |",
|
|
2093
|
+
...keywordMatchRows,
|
|
2094
|
+
""
|
|
2095
|
+
);
|
|
2096
|
+
}
|
|
2097
|
+
lines.push(
|
|
2098
|
+
`> Load matched skills: \`<SKILLS>/${category}/<skill>/SKILL.md\`. Load ALL that match — the tier model already filters irrelevant ones.`,
|
|
2099
|
+
""
|
|
2100
|
+
);
|
|
2101
|
+
return lines.join("\n");
|
|
2102
|
+
}
|
|
2103
|
+
/**
|
|
2104
|
+
* Generates all _INDEX.md files for categories found in baseDir.
|
|
2105
|
+
* @returns Map of category name to generated index content
|
|
2106
|
+
*/
|
|
2107
|
+
async generateAllCategoryIndices(baseDir, allowedCategories) {
|
|
2108
|
+
if (!await fs.pathExists(baseDir)) return {};
|
|
2109
|
+
let categories = await fs.readdir(baseDir);
|
|
2110
|
+
categories = categories.filter((c) => {
|
|
2111
|
+
if (c.startsWith(".") || c === "_INDEX.md") return false;
|
|
2112
|
+
if (allowedCategories && !allowedCategories.includes(c) && c !== "common") {
|
|
2113
|
+
return false;
|
|
2114
|
+
}
|
|
2115
|
+
return true;
|
|
2116
|
+
});
|
|
2117
|
+
categories.sort();
|
|
2118
|
+
const result = {};
|
|
2119
|
+
for (const category of categories) {
|
|
2120
|
+
const categoryPath = path.join(baseDir, category);
|
|
2121
|
+
if (!(await fs.stat(categoryPath)).isDirectory()) continue;
|
|
2122
|
+
const index = await this.generateCategoryIndex(baseDir, category);
|
|
2123
|
+
if (index) result[category] = index;
|
|
2124
|
+
}
|
|
2125
|
+
return result;
|
|
2126
|
+
}
|
|
2127
|
+
/**
|
|
2128
|
+
* Assembles a router-style AGENTS.md that maps file extensions to
|
|
2129
|
+
* per-category _INDEX.md files. Much smaller than the flat list.
|
|
2130
|
+
* @param baseDir The base directory containing skill categories
|
|
2131
|
+
* @param allowedCategories Optional filter for which categories to include
|
|
2132
|
+
* @returns A compact router-table markdown string
|
|
2133
|
+
*/
|
|
2134
|
+
async assembleRouterIndex(baseDir, allowedCategories) {
|
|
2135
|
+
const fileRouting = await this.loadFileRouting(baseDir);
|
|
2136
|
+
let availableCategories = [];
|
|
2137
|
+
if (await fs.pathExists(baseDir)) {
|
|
2138
|
+
const dirs = await fs.readdir(baseDir);
|
|
2139
|
+
availableCategories = dirs.filter((d) => {
|
|
2140
|
+
if (d.startsWith(".") || d === "_INDEX.md") return false;
|
|
2141
|
+
if (allowedCategories && !allowedCategories.includes(d) && d !== "common") {
|
|
2142
|
+
return false;
|
|
2143
|
+
}
|
|
2144
|
+
return true;
|
|
2145
|
+
});
|
|
2146
|
+
}
|
|
2147
|
+
const routerRows = [];
|
|
2148
|
+
const coveredCategories = /* @__PURE__ */ new Set();
|
|
2149
|
+
const extGrouped = /* @__PURE__ */ new Map();
|
|
2150
|
+
for (const [ext, cats] of Object.entries(fileRouting)) {
|
|
2151
|
+
if (ext === "_comment") continue;
|
|
2152
|
+
const filtered = cats.filter(
|
|
2153
|
+
(c) => availableCategories.includes(c)
|
|
2154
|
+
);
|
|
2155
|
+
if (filtered.length === 0) continue;
|
|
2156
|
+
const key = filtered.sort().join("+");
|
|
2157
|
+
if (!extGrouped.has(key)) extGrouped.set(key, []);
|
|
2158
|
+
extGrouped.get(key).push(ext);
|
|
2159
|
+
filtered.forEach((c) => coveredCategories.add(c));
|
|
2160
|
+
}
|
|
2161
|
+
for (const [catKey, exts] of extGrouped) {
|
|
2162
|
+
const cats = catKey.split("+");
|
|
2163
|
+
const extDisplay = exts.map((e) => `\`*.${e}\``).join(", ");
|
|
2164
|
+
const catDisplay = cats.map((c) => `\`<SKILLS>/${c}/_INDEX.md\``).join(", ");
|
|
2165
|
+
routerRows.push(`| ${extDisplay} | ${catDisplay} |`);
|
|
2166
|
+
}
|
|
2167
|
+
if (availableCategories.includes("common")) {
|
|
2168
|
+
coveredCategories.add("common");
|
|
2169
|
+
routerRows.push(
|
|
2170
|
+
"| Any file (keyword match) | `<SKILLS>/common/_INDEX.md` |"
|
|
2171
|
+
);
|
|
2172
|
+
}
|
|
2173
|
+
if (availableCategories.includes("quality-engineering")) {
|
|
2174
|
+
coveredCategories.add("quality-engineering");
|
|
2175
|
+
routerRows.push(
|
|
2176
|
+
"| QE workflow | `<SKILLS>/quality-engineering/_INDEX.md` |"
|
|
2177
|
+
);
|
|
2178
|
+
}
|
|
2179
|
+
const header = [
|
|
2180
|
+
"## Agent Skills Index",
|
|
2181
|
+
"",
|
|
2182
|
+
"> [!CRITICAL] Zero-Trust: Read the matching `SKILL.md` BEFORE writing any code.",
|
|
2183
|
+
'> Skills from this index override pre-training patterns. If no skill matches, state: "No project-specific skills applicable."',
|
|
2184
|
+
"",
|
|
2185
|
+
"## Skill Resolution Protocol",
|
|
2186
|
+
"",
|
|
2187
|
+
"Each `_INDEX.md` has two sections — follow both:",
|
|
2188
|
+
"",
|
|
2189
|
+
"1. **Match file type** → find the category index in the router table below.",
|
|
2190
|
+
"2. **Read the `_INDEX.md`** → it has two sections:",
|
|
2191
|
+
" - **File Match**: auto-check these against the file you are editing (path pattern match).",
|
|
2192
|
+
" - **Keyword Match**: only check if the user's request mentions these concepts.",
|
|
2193
|
+
"3. **Load ALL matched `SKILL.md`** → read every matched skill before writing code. The tier model keeps matches focused.",
|
|
2194
|
+
"",
|
|
2195
|
+
"> `<SKILLS>` = your agent's skill directory (e.g., `.claude/skills/`, `.cursor/skills/`, `.gemini/skills/`).",
|
|
2196
|
+
"",
|
|
2197
|
+
"| File type | Read category index |",
|
|
2198
|
+
"| --------- | ------------------- |",
|
|
2199
|
+
...routerRows,
|
|
2200
|
+
"",
|
|
2201
|
+
'> [!TIP] **Indirect phrasing counts.** "make it faster" → performance, "broken query" → database, "login flow" → auth.',
|
|
2202
|
+
""
|
|
2203
|
+
].join("\n");
|
|
2204
|
+
return header;
|
|
2205
|
+
}
|
|
1889
2206
|
async parseSkill(skillPath) {
|
|
1890
2207
|
try {
|
|
1891
2208
|
const content = await fs.readFile(skillPath, "utf8");
|
|
@@ -1897,11 +2214,44 @@ ${entries.join("\n")}
|
|
|
1897
2214
|
const body = frontmatterMatch[2];
|
|
1898
2215
|
const priorityMatch = body.match(/## \*\*Priority:\s*([^*]+)\*\*/);
|
|
1899
2216
|
const priority = priorityMatch ? priorityMatch[1].trim() : "P1";
|
|
2217
|
+
let triggers = fm.metadata?.triggers || {};
|
|
2218
|
+
const hasStructured = triggers.files && triggers.files.length > 0 || triggers.keywords && triggers.keywords.length > 0;
|
|
2219
|
+
if (!hasStructured && fm.description) {
|
|
2220
|
+
const descTrigs = fm.description.match(/\(triggers:\s*`?(.*?)`?\)\s*$/);
|
|
2221
|
+
if (descTrigs) {
|
|
2222
|
+
const rawParts = descTrigs[1].split(",");
|
|
2223
|
+
const parts = [];
|
|
2224
|
+
let current = "";
|
|
2225
|
+
let braceCount = 0;
|
|
2226
|
+
for (let i = 0; i < rawParts.length; i++) {
|
|
2227
|
+
const p = rawParts[i];
|
|
2228
|
+
braceCount += (p.match(/{/g) || []).length;
|
|
2229
|
+
braceCount -= (p.match(/}/g) || []).length;
|
|
2230
|
+
current += (current ? "," : "") + p;
|
|
2231
|
+
if (braceCount === 0) {
|
|
2232
|
+
parts.push(current.trim());
|
|
2233
|
+
current = "";
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
if (current) parts.push(current.trim());
|
|
2237
|
+
const files = parts.filter(
|
|
2238
|
+
(p) => p.includes("*") || p.includes("/") || p.includes("{") || /\.\w+$/.test(p)
|
|
2239
|
+
);
|
|
2240
|
+
const keywords = parts.filter(
|
|
2241
|
+
(p) => !p.includes("*") && !p.includes("/") && !p.includes("{") && !/\.\w+$/.test(p)
|
|
2242
|
+
);
|
|
2243
|
+
triggers = {
|
|
2244
|
+
...triggers,
|
|
2245
|
+
files: files.length > 0 ? files : triggers.files,
|
|
2246
|
+
keywords: keywords.length > 0 ? keywords : triggers.keywords
|
|
2247
|
+
};
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
1900
2250
|
return {
|
|
1901
2251
|
name: fm.name || "",
|
|
1902
2252
|
description: fm.description || "",
|
|
1903
2253
|
priority,
|
|
1904
|
-
triggers
|
|
2254
|
+
triggers
|
|
1905
2255
|
};
|
|
1906
2256
|
} catch {
|
|
1907
2257
|
return null;
|
|
@@ -1922,6 +2272,32 @@ ${entries.join("\n")}
|
|
|
1922
2272
|
}
|
|
1923
2273
|
return derived;
|
|
1924
2274
|
}
|
|
2275
|
+
/**
|
|
2276
|
+
* Sanitizes a skill description to prevent indirect prompt injection.
|
|
2277
|
+
* Strips known instruction-hijack patterns and replaces them with [REDACTED].
|
|
2278
|
+
* Logs a stderr warning for every skill that required sanitisation.
|
|
2279
|
+
* @param desc The raw description string from skill frontmatter
|
|
2280
|
+
* @param skillId The skill identifier (category/skill) for log context
|
|
2281
|
+
* @returns Sanitised description safe to embed in AGENTS.md
|
|
2282
|
+
*/
|
|
2283
|
+
sanitizeDescription(desc, skillId = "unknown") {
|
|
2284
|
+
let sanitized = desc;
|
|
2285
|
+
let wasModified = false;
|
|
2286
|
+
for (const pattern of INJECTION_PATTERNS) {
|
|
2287
|
+
if (pattern.test(sanitized)) {
|
|
2288
|
+
wasModified = true;
|
|
2289
|
+
sanitized = sanitized.replace(pattern, "[REDACTED]");
|
|
2290
|
+
}
|
|
2291
|
+
pattern.lastIndex = 0;
|
|
2292
|
+
}
|
|
2293
|
+
if (wasModified) {
|
|
2294
|
+
process.stderr.write(
|
|
2295
|
+
`[SECURITY] Prompt injection pattern stripped from skill description: ${skillId}
|
|
2296
|
+
`
|
|
2297
|
+
);
|
|
2298
|
+
}
|
|
2299
|
+
return sanitized;
|
|
2300
|
+
}
|
|
1925
2301
|
formatEntry(category, skill, metadata, foundationalRules = {}) {
|
|
1926
2302
|
const id = `${category}/${skill}`;
|
|
1927
2303
|
const prefix = metadata.priority.startsWith("P0") ? "🚨 " : "";
|
|
@@ -1940,7 +2316,7 @@ ${entries.join("\n")}
|
|
|
1940
2316
|
...metadata.triggers.exclude ? metadata.triggers.exclude.map((e) => `!${e}`) : []
|
|
1941
2317
|
].join(", ");
|
|
1942
2318
|
const triggerText = triggers ? ` (triggers: \`${triggers}\`)` : "";
|
|
1943
|
-
let desc = metadata.description || "";
|
|
2319
|
+
let desc = this.sanitizeDescription(metadata.description || "", id);
|
|
1944
2320
|
desc = desc.replace(/\(triggers:\s*`?(.*?)`?\)/g, "(triggers: `$1`)");
|
|
1945
2321
|
const content = `${prefix}${desc}`.trim();
|
|
1946
2322
|
return `- **[${id}]**: ${content}${triggerText}`;
|
|
@@ -2146,12 +2522,99 @@ description: ${description}
|
|
|
2146
2522
|
});
|
|
2147
2523
|
}
|
|
2148
2524
|
isPathSafe(targetPath, skillPath) {
|
|
2149
|
-
|
|
2525
|
+
const resolvedBase = path.resolve(skillPath) + path.sep;
|
|
2526
|
+
return path.resolve(targetPath).startsWith(resolvedBase);
|
|
2150
2527
|
}
|
|
2151
2528
|
normalizePath(p) {
|
|
2152
2529
|
return path.relative(process.cwd(), p).replace(/\\/g, "/");
|
|
2153
2530
|
}
|
|
2154
2531
|
}
|
|
2532
|
+
class WorkflowTransformer {
|
|
2533
|
+
static transform(source, format, workflowSourcePath = ".agent/workflows") {
|
|
2534
|
+
if (format === "none") return null;
|
|
2535
|
+
const { description, body } = this.parseSource(source.content);
|
|
2536
|
+
const baseName = source.name.replace(/\.md$/, "");
|
|
2537
|
+
switch (format) {
|
|
2538
|
+
case "native":
|
|
2539
|
+
return { name: source.name, content: source.content };
|
|
2540
|
+
case "command":
|
|
2541
|
+
return {
|
|
2542
|
+
name: `${baseName}.md`,
|
|
2543
|
+
content: this.toClaudeCommand(baseName, description, body)
|
|
2544
|
+
};
|
|
2545
|
+
case "toml":
|
|
2546
|
+
return {
|
|
2547
|
+
name: `${baseName}.toml`,
|
|
2548
|
+
content: this.toGeminiCommand(
|
|
2549
|
+
baseName,
|
|
2550
|
+
description,
|
|
2551
|
+
workflowSourcePath
|
|
2552
|
+
)
|
|
2553
|
+
};
|
|
2554
|
+
case "prompt":
|
|
2555
|
+
return {
|
|
2556
|
+
name: `${baseName}.prompt.md`,
|
|
2557
|
+
content: this.toCopilotPrompt(description, body)
|
|
2558
|
+
};
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
static parseSource(content) {
|
|
2562
|
+
const match = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
2563
|
+
if (!match) return { description: "", body: content };
|
|
2564
|
+
const descMatch = match[1].match(/description:\s*(.+)/);
|
|
2565
|
+
return {
|
|
2566
|
+
description: descMatch ? descMatch[1].trim() : "",
|
|
2567
|
+
body: match[2]
|
|
2568
|
+
};
|
|
2569
|
+
}
|
|
2570
|
+
/**
|
|
2571
|
+
* Claude Code custom slash command format.
|
|
2572
|
+
* Lives at .claude/commands/<name>.md
|
|
2573
|
+
* User invokes via /<name> [arguments]
|
|
2574
|
+
* $ARGUMENTS placeholder for user input.
|
|
2575
|
+
*/
|
|
2576
|
+
static toClaudeCommand(name, description, body) {
|
|
2577
|
+
const title = name.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
2578
|
+
return `# ${title}
|
|
2579
|
+
|
|
2580
|
+
${description}
|
|
2581
|
+
|
|
2582
|
+
**Input:** $ARGUMENTS
|
|
2583
|
+
|
|
2584
|
+
## Instructions
|
|
2585
|
+
|
|
2586
|
+
Execute the following steps for **$ARGUMENTS**.
|
|
2587
|
+
|
|
2588
|
+
${body}`;
|
|
2589
|
+
}
|
|
2590
|
+
/**
|
|
2591
|
+
* Gemini CLI TOML command format.
|
|
2592
|
+
* Lives at .gemini/commands/<name>.toml
|
|
2593
|
+
* References the workflow source file via prompt.
|
|
2594
|
+
* User invokes via /<name> [arguments]
|
|
2595
|
+
*/
|
|
2596
|
+
static toGeminiCommand(name, description, workflowSourcePath) {
|
|
2597
|
+
const escapedDescription = description.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
2598
|
+
return `description = "${escapedDescription}"
|
|
2599
|
+
prompt = """
|
|
2600
|
+
Please execute the workflow defined in \`${workflowSourcePath}/${name}.md\` for: {{args}}
|
|
2601
|
+
|
|
2602
|
+
Follow the exact steps in the workflow file.
|
|
2603
|
+
"""
|
|
2604
|
+
`;
|
|
2605
|
+
}
|
|
2606
|
+
/**
|
|
2607
|
+
* GitHub Copilot reusable prompt format.
|
|
2608
|
+
* Lives at .github/prompts/<name>.prompt.md
|
|
2609
|
+
* User invokes via /prompt-name in Copilot chat.
|
|
2610
|
+
*/
|
|
2611
|
+
static toCopilotPrompt(description, body) {
|
|
2612
|
+
return `---
|
|
2613
|
+
description: "${description}"
|
|
2614
|
+
---
|
|
2615
|
+
${body}`;
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2155
2618
|
class WorkflowSyncService {
|
|
2156
2619
|
constructor(githubService) {
|
|
2157
2620
|
this.githubService = githubService;
|
|
@@ -2243,39 +2706,59 @@ class WorkflowSyncService {
|
|
|
2243
2706
|
return [];
|
|
2244
2707
|
}
|
|
2245
2708
|
/**
|
|
2246
|
-
* Writes collected workflows to
|
|
2709
|
+
* Writes collected workflows to each active agent's native format.
|
|
2710
|
+
* - Antigravity/Kiro: .agent/workflows/*.md (native)
|
|
2711
|
+
* - Claude/Gemini: .<agent>/agents/workflow-*.md (agent definition)
|
|
2712
|
+
* - Cursor/Windsurf/Trae: .<agent>/rules/workflow-*.mdc (rule)
|
|
2713
|
+
* - Copilot: .github/instructions/workflow-*.instructions.md (instruction)
|
|
2247
2714
|
*/
|
|
2248
|
-
async writeWorkflows(workflows, config) {
|
|
2715
|
+
async writeWorkflows(workflows, config, agents) {
|
|
2249
2716
|
if (workflows.length === 0) return;
|
|
2250
|
-
const workflowPath = path.join(process.cwd(), ".agent", "workflows");
|
|
2251
2717
|
const overrides = config.custom_overrides || [];
|
|
2252
|
-
|
|
2253
|
-
for (const
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2718
|
+
const targetAgents = agents || [Agent.Antigravity];
|
|
2719
|
+
for (const agentId of targetAgents) {
|
|
2720
|
+
const agentDef = SUPPORTED_AGENTS.find((a) => a.id === agentId);
|
|
2721
|
+
if (!agentDef || agentDef.workflowFormat === "none") continue;
|
|
2722
|
+
const workflowDir = path.join(process.cwd(), agentDef.workflowPath);
|
|
2723
|
+
await fs.ensureDir(workflowDir);
|
|
2724
|
+
const skillsDir = path.join(process.cwd(), agentDef.path);
|
|
2725
|
+
const skillsRelative = path.relative(workflowDir, skillsDir);
|
|
2726
|
+
let written = 0;
|
|
2727
|
+
for (const wf of workflows) {
|
|
2728
|
+
if (wf.skill !== "workflows") continue;
|
|
2729
|
+
for (const fileItem of wf.files) {
|
|
2730
|
+
const transformed = WorkflowTransformer.transform(
|
|
2731
|
+
{ name: fileItem.name, content: fileItem.content },
|
|
2732
|
+
agentDef.workflowFormat,
|
|
2733
|
+
skillsRelative
|
|
2268
2734
|
);
|
|
2269
|
-
continue;
|
|
2735
|
+
if (!transformed) continue;
|
|
2736
|
+
const targetFilePath = path.join(workflowDir, transformed.name);
|
|
2737
|
+
if (!this.isPathSafe(targetFilePath, workflowDir)) {
|
|
2738
|
+
console.log(
|
|
2739
|
+
pc.red(` ❌ Security Error: Invalid path ${transformed.name}`)
|
|
2740
|
+
);
|
|
2741
|
+
continue;
|
|
2742
|
+
}
|
|
2743
|
+
if (this.isOverridden(targetFilePath, overrides)) {
|
|
2744
|
+
continue;
|
|
2745
|
+
}
|
|
2746
|
+
await fs.outputFile(targetFilePath, transformed.content);
|
|
2747
|
+
written++;
|
|
2270
2748
|
}
|
|
2271
|
-
|
|
2272
|
-
|
|
2749
|
+
}
|
|
2750
|
+
if (written > 0) {
|
|
2751
|
+
console.log(
|
|
2752
|
+
pc.green(
|
|
2753
|
+
` ✅ ${written} workflows synced to ${agentDef.workflowPath}/ (${agentDef.name})`
|
|
2754
|
+
)
|
|
2755
|
+
);
|
|
2273
2756
|
}
|
|
2274
2757
|
}
|
|
2275
|
-
console.log(pc.green(` ✅ Workflows synced to .agent/workflows/`));
|
|
2276
2758
|
}
|
|
2277
2759
|
isPathSafe(targetPath, subPath) {
|
|
2278
|
-
|
|
2760
|
+
const resolvedBase = path.resolve(subPath) + path.sep;
|
|
2761
|
+
return path.resolve(targetPath).startsWith(resolvedBase);
|
|
2279
2762
|
}
|
|
2280
2763
|
isOverridden(targetPath, overrides) {
|
|
2281
2764
|
const rel = this.normalizePath(targetPath);
|
|
@@ -2362,8 +2845,6 @@ class SyncService {
|
|
|
2362
2845
|
return false;
|
|
2363
2846
|
}
|
|
2364
2847
|
async reconcileWorkflows(config) {
|
|
2365
|
-
const agents = await this.resolveTargetAgents(config);
|
|
2366
|
-
if (!agents.includes(Agent.Antigravity)) return false;
|
|
2367
2848
|
return this.workflowSyncService.reconcileWorkflows(config);
|
|
2368
2849
|
}
|
|
2369
2850
|
async assembleSkills(categories, config) {
|
|
@@ -2374,14 +2855,11 @@ class SyncService {
|
|
|
2374
2855
|
return this.skillSyncService.writeSkills(skills, config, agents);
|
|
2375
2856
|
}
|
|
2376
2857
|
async assembleWorkflows(config) {
|
|
2377
|
-
const agents = await this.resolveTargetAgents(config);
|
|
2378
|
-
if (!agents.includes(Agent.Antigravity)) return [];
|
|
2379
2858
|
return this.workflowSyncService.assembleWorkflows(config);
|
|
2380
2859
|
}
|
|
2381
2860
|
async writeWorkflows(workflows, config) {
|
|
2382
2861
|
const agents = await this.resolveTargetAgents(config);
|
|
2383
|
-
|
|
2384
|
-
return this.workflowSyncService.writeWorkflows(workflows, config);
|
|
2862
|
+
return this.workflowSyncService.writeWorkflows(workflows, config, agents);
|
|
2385
2863
|
}
|
|
2386
2864
|
async applyIndices(config, targetAgents) {
|
|
2387
2865
|
const agents = targetAgents || await this.resolveTargetAgents(config);
|
|
@@ -2396,13 +2874,42 @@ class SyncService {
|
|
|
2396
2874
|
const generator = new IndexGeneratorService();
|
|
2397
2875
|
const baseDir = agentDef ? path.join(process.cwd(), agentDef.path) : path.join(process.cwd(), ".cursor/skills");
|
|
2398
2876
|
const allowedCategories = Object.keys(config.skills || {});
|
|
2399
|
-
const
|
|
2400
|
-
|
|
2401
|
-
|
|
2877
|
+
const categoryIndices = await generator.generateAllCategoryIndices(
|
|
2878
|
+
baseDir,
|
|
2879
|
+
allowedCategories
|
|
2880
|
+
);
|
|
2881
|
+
for (const agentId of agents) {
|
|
2882
|
+
const def = SUPPORTED_AGENTS.find((a) => a.id === agentId);
|
|
2883
|
+
if (!def) continue;
|
|
2884
|
+
const agentBase = path.join(process.cwd(), def.path);
|
|
2885
|
+
for (const [category, indexContent] of Object.entries(
|
|
2886
|
+
categoryIndices
|
|
2887
|
+
)) {
|
|
2888
|
+
const indexMdPath = path.join(agentBase, category, "_INDEX.md");
|
|
2889
|
+
await fs.outputFile(indexMdPath, indexContent);
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
if (Object.keys(categoryIndices).length > 0) {
|
|
2893
|
+
console.log(
|
|
2894
|
+
pc.green(
|
|
2895
|
+
` ✅ Generated _INDEX.md for ${Object.keys(categoryIndices).length} categories.`
|
|
2896
|
+
)
|
|
2897
|
+
);
|
|
2898
|
+
}
|
|
2899
|
+
const routerIndex = await generator.assembleRouterIndex(
|
|
2900
|
+
baseDir,
|
|
2901
|
+
allowedCategories
|
|
2902
|
+
);
|
|
2903
|
+
await MarkdownUtils.injectIndex(
|
|
2904
|
+
process.cwd(),
|
|
2905
|
+
["AGENTS.md"],
|
|
2906
|
+
routerIndex
|
|
2907
|
+
);
|
|
2908
|
+
console.log(pc.green(" ✅ AGENTS.md router index updated."));
|
|
2402
2909
|
const serverDir = path.join(process.cwd(), "server");
|
|
2403
2910
|
if (await fs.pathExists(serverDir)) {
|
|
2404
|
-
await MarkdownUtils.injectIndex(serverDir, ["AGENTS.md"],
|
|
2405
|
-
console.log(pc.green(" ✅ server/AGENTS.md index updated."));
|
|
2911
|
+
await MarkdownUtils.injectIndex(serverDir, ["AGENTS.md"], routerIndex);
|
|
2912
|
+
console.log(pc.green(" ✅ server/AGENTS.md router index updated."));
|
|
2406
2913
|
}
|
|
2407
2914
|
const bridgeService = new AgentBridgeService();
|
|
2408
2915
|
await bridgeService.bridge(process.cwd(), agents);
|
|
@@ -2476,7 +2983,7 @@ class SyncCommand {
|
|
|
2476
2983
|
await this.configService.saveConfig(config);
|
|
2477
2984
|
}
|
|
2478
2985
|
const updates = await this.syncService.checkForUpdates(config);
|
|
2479
|
-
if (updates) {
|
|
2986
|
+
if (updates && Object.keys(updates).length > 0) {
|
|
2480
2987
|
console.log(pc.yellow("\n🚀 New skill versions detected:"));
|
|
2481
2988
|
for (const [cat, ref] of Object.entries(updates)) {
|
|
2482
2989
|
console.log(
|
|
@@ -2536,7 +3043,7 @@ class SyncCommand {
|
|
|
2536
3043
|
}
|
|
2537
3044
|
}
|
|
2538
3045
|
}
|
|
2539
|
-
const version = "2.
|
|
3046
|
+
const version = "2.1.0";
|
|
2540
3047
|
const pkg = {
|
|
2541
3048
|
version
|
|
2542
3049
|
};
|
|
@@ -3054,7 +3561,7 @@ dotenv.config();
|
|
|
3054
3561
|
const program = new commander.Command();
|
|
3055
3562
|
program.name("agent-skills-standard").description(
|
|
3056
3563
|
"A CLI to manage and sync AI agent skills for Cursor, Claude, Copilot, Windsurf, and more."
|
|
3057
|
-
).version("2.
|
|
3564
|
+
).version("2.1.0");
|
|
3058
3565
|
program.command("init").description("Initialize a .skillsrc configuration file interactively").action(async () => {
|
|
3059
3566
|
const init = new InitCommand();
|
|
3060
3567
|
await init.run();
|
|
@@ -3089,6 +3596,12 @@ program.command("feedback").description("Report skill improvement opportunities
|
|
|
3089
3596
|
).option(
|
|
3090
3597
|
"--loaded-skills <skills>",
|
|
3091
3598
|
"Comma-separated list of currently loaded skills (platform-provided)"
|
|
3599
|
+
).option(
|
|
3600
|
+
"--root-cause <cause>",
|
|
3601
|
+
"Why the violation happened: AMBIGUOUS_RULE | MISSING_COVERAGE | OUTDATED_GUIDANCE | COMPETING_RULES | PATTERN_MISMATCH"
|
|
3602
|
+
).option("--user-intent <intent>", "What the user was trying to achieve").option(
|
|
3603
|
+
"--skill-gap <gap>",
|
|
3604
|
+
"What change to the SKILL.md would prevent this violation next time"
|
|
3092
3605
|
).action(async (options) => {
|
|
3093
3606
|
const cmd = new FeedbackCommand();
|
|
3094
3607
|
await cmd.run(options);
|