Don't write ahp commit hash to every file (#305695)

* Don't write ahp commit hash to every file

Co-authored-by: Copilot <copilot@github.com>

* undo

---------

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Rob Lourens
2026-03-27 08:54:33 -07:00
committed by GitHub
parent 9b0dd7c567
commit 492790d5ca
11 changed files with 17 additions and 12 deletions

View File

@@ -172,7 +172,7 @@ function mergeDuplicateImports(content: string): string {
function processFile(src: string, dest: string, commitHash: string): void {
function processFile(src: string, dest: string): void {
let content = fs.readFileSync(src, 'utf-8');
content = stripExistingHeader(content);
@@ -182,7 +182,7 @@ function processFile(src: string, dest: string, commitHash: string): void {
content = convertIndentation(content);
content = content.split('\n').map(line => line.trimEnd()).join('\n');
const header = `${COPYRIGHT}\n\n${BANNER}\n// Synced from agent-host-protocol @ ${commitHash}\n`;
const header = `${COPYRIGHT}\n\n${BANNER}\n`;
content = header + '\n' + content;
if (!content.endsWith('\n')) {
@@ -219,9 +219,14 @@ function main() {
console.error(` SKIP (not found): ${file.src}`);
continue;
}
processFile(srcPath, file.dest, commitHash);
processFile(srcPath, file.dest);
}
// Write the source commit hash to a single version file
const versionFile = path.join(DEST_DIR, '.ahp-version');
fs.writeFileSync(versionFile, commitHash + '\n', 'utf-8');
console.log(` .ahp-version -> ${commitHash}`);
console.log();
console.log('Done.');
}