ContextKeeper v1.0.0 — Persistent AI coding session context Chrome extension
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
const fs = require('fs');
|
||||
const zlib = require('zlib');
|
||||
|
||||
function createPNG(width, height, r, g, b) {
|
||||
const lineSize = width * 3 + 1;
|
||||
const rawSize = height * lineSize;
|
||||
const raw = Buffer.alloc(rawSize);
|
||||
|
||||
for (let y = 0; y < height; y++) {
|
||||
raw[y * lineSize] = 0;
|
||||
for (let x = 0; x < width; x++) {
|
||||
const offset = y * lineSize + 1 + x * 3;
|
||||
raw[offset] = r;
|
||||
raw[offset + 1] = g;
|
||||
raw[offset + 2] = b;
|
||||
}
|
||||
}
|
||||
|
||||
const compressed = zlib.deflateSync(raw);
|
||||
|
||||
function chunk(type, data) {
|
||||
const typeBuf = Buffer.from(type, 'ascii');
|
||||
const len = Buffer.alloc(4);
|
||||
len.writeUInt32BE(data.length, 0);
|
||||
const crc = Buffer.alloc(4);
|
||||
const crcData = Buffer.concat([typeBuf, data]);
|
||||
crc.writeUInt32BE(zlib.crc32(crcData), 0);
|
||||
return Buffer.concat([len, typeBuf, data, crc]);
|
||||
}
|
||||
|
||||
const ihdr = Buffer.alloc(13);
|
||||
ihdr.writeUInt32BE(width, 0);
|
||||
ihdr.writeUInt32BE(height, 4);
|
||||
ihdr[8] = 8;
|
||||
ihdr[9] = 2;
|
||||
ihdr[10] = 0;
|
||||
ihdr[11] = 0;
|
||||
ihdr[12] = 0;
|
||||
|
||||
const sig = Buffer.from([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]);
|
||||
const ihdrChunk = chunk('IHDR', ihdr);
|
||||
const idatChunk = chunk('IDAT', compressed);
|
||||
const iendChunk = chunk('IEND', Buffer.alloc(0));
|
||||
|
||||
return Buffer.concat([sig, ihdrChunk, idatChunk, iendChunk]);
|
||||
}
|
||||
|
||||
fs.mkdirSync('icons', { recursive: true });
|
||||
fs.writeFileSync('icons/icon16.png', createPNG(16, 16, 16, 185, 129));
|
||||
fs.writeFileSync('icons/icon48.png', createPNG(48, 48, 16, 185, 129));
|
||||
fs.writeFileSync('icons/icon128.png', createPNG(128, 128, 16, 185, 129));
|
||||
console.log('Icons generated');
|
||||
Reference in New Issue
Block a user