feat(amazon-shopping): scaffold amazon product search skill

This commit is contained in:
2026-04-15 18:24:13 -05:00
parent 26a968797c
commit 8ad532545d
14 changed files with 1234 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/env node
import { readdir, readFile, stat } from "node:fs/promises";
import { join, relative } from "node:path";
const root = new URL("..", import.meta.url).pathname;
const scannedExtensions = new Set([".md", ".json", ".ts", ".js", ".mjs", ".sh"]);
const installSpecificPath = ["", "Users", "stefano"].join("/");
const forbidden = [
{
pattern: installSpecificPath,
message: "Source files must not hardcode this install path"
}
];
function extensionOf(path) {
const dot = path.lastIndexOf(".");
return dot === -1 ? "" : path.slice(dot);
}
async function walk(dir) {
const entries = await readdir(dir);
const files = [];
for (const entry of entries) {
if (["node_modules", "dist", "coverage", "tmp", "out"].includes(entry)) {
continue;
}
const path = join(dir, entry);
const info = await stat(path);
if (info.isDirectory()) {
files.push(...await walk(path));
} else if (scannedExtensions.has(extensionOf(path)) || entry === "SKILL.md") {
files.push(path);
}
}
return files;
}
const failures = [];
for (const file of await walk(root)) {
const text = await readFile(file, "utf8");
for (const rule of forbidden) {
if (text.includes(rule.pattern)) {
failures.push(`${relative(root, file)}: ${rule.message}`);
}
}
}
if (failures.length > 0) {
for (const failure of failures) {
console.error(failure);
}
process.exitCode = 1;
}