(name, sourceDir)
| 121 | } |
| 122 | |
| 123 | async function assertSkillCurrent(name, sourceDir) { |
| 124 | const destination = path.join(destinationRoot, name); |
| 125 | if (!existsSync(destination)) { |
| 126 | throw new Error(`${name} is missing at ${destination}`); |
| 127 | } |
| 128 | |
| 129 | const sourceFiles = (await listFiles(sourceDir)).filter( |
| 130 | (rel) => !publicDocOverlays.has(rel), |
| 131 | ); |
| 132 | const destinationFiles = (await listFiles(destination)).filter( |
| 133 | (rel) => !publicDocOverlays.has(rel), |
| 134 | ); |
| 135 | if (sourceFiles.join("\n") !== destinationFiles.join("\n")) { |
| 136 | throw new Error(`${name} file list is out of sync`); |
| 137 | } |
| 138 | |
| 139 | for (const rel of sourceFiles) { |
| 140 | const [sourceBody, destinationBody] = await Promise.all([ |
| 141 | readFile(path.join(sourceDir, rel), "utf8"), |
| 142 | readFile(path.join(destination, rel), "utf8"), |
| 143 | ]); |
| 144 | if (sourceBody !== destinationBody) { |
| 145 | throw new Error(`${name}/${rel} is out of sync`); |
| 146 | } |
| 147 | } |
| 148 | console.log(`${name} is current`); |
| 149 | } |
| 150 | |
| 151 | try { |
| 152 | const sources = resolveSources(requestedSource); |
no test coverage detected