Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ npm run dev:dry-run
npm run dev
```

## Brand icon and source distribution

The plugin owns its approved 256×256 brand PNG at
[`src/assets/identity/ascension.png`](src/assets/identity/ascension.png). The build
embeds these exact bytes in the public module `icon` export as
`{ mediaType: 'image/png', data }`, so Host plugin lists can consume the icon
without fetching a site asset. The petition site icons remain independent.

This private package is distributed from repository source; merging the PNG and
its generated module to `main` updates that source distribution. No npm release
or version tag is required for the icon change. `npm run check` verifies the
built export against the selected PNG hash and dimensions.

## 中文

这是 OpenAI Imperium 的 CordisX 思考强度主题插件。插件声明塑料白、青铜、
Expand Down
4 changes: 2 additions & 2 deletions plugin/scripts/generate-portrait-modules.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ await writeFile(
);

const identityRoot = fileURLToPath(new URL('../src/assets/identity/', import.meta.url));
const iconData = await readFile(fileURLToPath(new URL('../../public/apple-touch-icon.png', import.meta.url)), 'base64');
const iconData = await readFile(`${identityRoot}ascension.png`, 'base64');
await mkdir(identityRoot, { recursive: true });
await writeFile(
`${identityRoot}generated.ts`,
`// Generated from the approved site icon by scripts/generate-portrait-modules.mjs.\nexport const ascensionIcon: string = '${iconData}'\n`,
`// Generated from the plugin-owned brand icon by scripts/generate-portrait-modules.mjs.\nexport const ascensionIcon: string = '${iconData}'\n`,
);
Binary file added plugin/src/assets/identity/ascension.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions plugin/src/assets/identity/generated.ts

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion plugin/test/manifest.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { createHash } from 'node:crypto';
import { readFileSync } from 'node:fs';
import {
apply,
backdrop,
Expand All @@ -17,7 +19,14 @@ test('exports a capability-free structured CordisX plugin', () => {
assert.equal(manifest.id, 'codex-ascension');
assert.deepEqual(manifest.capabilities, []);
assert.equal(icon.mediaType, 'image/png');
assert.ok(icon.data.length > 50_000);
const iconBytes = Buffer.from(icon.data, 'base64');
assert.deepEqual(iconBytes, readFileSync(new URL('../src/assets/identity/ascension.png', import.meta.url)));
assert.equal(
createHash('sha256').update(iconBytes).digest('hex'),
'2a037ea870d249272dc3ff7de69fc178e06fa89dc16dbfe8bebfc5bdc966626c',
);
assert.equal(iconBytes.readUInt32BE(16), 256);
assert.equal(iconBytes.readUInt32BE(20), 256);
assert.deepEqual(inject, ['i18n', 'slots']);
assert.equal(configApplies, 'plugin-restart');
assert.deepEqual(Config({}), {
Expand Down
Loading