Skip to content

Commit a29432e

Browse files
authored
feat: add exclusion for additional bundled skill files in review generation (#1285)
1 parent ea3f0c0 commit a29432e

2 files changed

Lines changed: 20 additions & 19 deletions

File tree

scripts/generate-review-builtin.mjs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,23 @@ function collectLocales(index) {
7979
return [...localeSet].sort()
8080
}
8181

82+
const EXCLUDED_BUNDLED_SKILL_FILES = new Set([
83+
"php_deserialization.md",
84+
"java_practical.md",
85+
])
86+
87+
async function removeExcludedBundledSkillFiles(dir = bundledSkillsDir) {
88+
for (const entry of await fs.readdir(dir, { withFileTypes: true }).catch(() => [])) {
89+
const entryPath = path.join(dir, entry.name)
90+
if (entry.isDirectory()) {
91+
await removeExcludedBundledSkillFiles(entryPath)
92+
} else if (EXCLUDED_BUNDLED_SKILL_FILES.has(entry.name)) {
93+
await fs.rm(entryPath)
94+
console.log(` ⚠ Removed excluded file: ${entryPath}`)
95+
}
96+
}
97+
}
98+
8299
async function getExtensionVersion() {
83100
try {
84101
const packagePath = path.join(projectRoot, "src", "package.json")
@@ -105,24 +122,6 @@ async function cloneAndCopy(cloneDir, index) {
105122
await fs.rm(entryPath, { recursive: true, force: true })
106123
}
107124
}
108-
// Files to always exclude from bundled skills (flagged by VS Marketplace virus scan)
109-
const excludeFiles = new Set([
110-
"php_deserialization.md",
111-
])
112-
113-
async function removeExcludedFiles(dir) {
114-
for (const file of excludeFiles) {
115-
const filePath = path.join(dir, file)
116-
try {
117-
await fs.access(filePath)
118-
await fs.rm(filePath)
119-
console.log(` ⚠ Removed excluded file: ${filePath}`)
120-
} catch {
121-
// File not present, skip
122-
}
123-
}
124-
}
125-
126125
for (const locale of locales) {
127126
for (const skill of index.skills) {
128127
const skillMdPath = skill.path[locale]
@@ -137,7 +136,7 @@ async function cloneAndCopy(cloneDir, index) {
137136
await fs.cp(srcDir, outputDir, { recursive: true })
138137

139138
// Remove files that are flagged by VS Marketplace
140-
await removeExcludedFiles(outputDir)
139+
await removeExcludedBundledSkillFiles(outputDir)
141140

142141
// Verify SKILL.md exists
143142
const skillMd = path.join(outputDir, "SKILL.md")
@@ -244,6 +243,7 @@ async function main() {
244243
}
245244
}
246245

246+
await removeExcludedBundledSkillFiles()
247247
await generateIndexJson(commitSha)
248248

249249
console.log(`✓ Bundled skills directory: ${bundledSkillsDir}`)

src/.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
# Exclude files flagged by VS Marketplace virus scan.
4545
# Wildcard matches across all locale subdirectories (en/, zh-CN/, etc.).
4646
bundled-skills/*/security-review/knowledge/languages/php_deserialization.md
47+
bundled-skills/*/security-review/knowledge/languages/java_practical.md
4748

4849
# Include .env file for telemetry
4950
!.env

0 commit comments

Comments
 (0)