[tauri] AtriumManifest: Ship domi-app.toml beside rosea-shell.exe for Atrium Domi, built from the name and version; 27 hostile fixtures refused with the parser's codes; no door, by the author's ruling
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* The `domi-app.toml` that lets Atrium Domi show Rosea Domi in its grid (Atrium docs/APP_CONTRACT.md v0, §2–3;
|
||||
* .agents/features/atrium-adoption.md). It is made before every desktop build from the name constants and the game's
|
||||
* version, so the name stays in its three places (CLAUDE.md, header) and the version in Fabrica's four files
|
||||
* (scripts/check-version.mjs). It is build output, never committed. `tauri.windows.conf.json` puts it next to the
|
||||
* `.exe`, with the icon it names.
|
||||
*
|
||||
* tsx scripts/domi-app.ts writes src-tauri/atrium/domi-app.toml
|
||||
*
|
||||
* This is a static file only. Rosea reads nothing of Atrium's and calls nothing; the door (APP_CONTRACT §4–5) waits
|
||||
* on the author (atrium-adoption.md R4). What APP_CONTRACT §7 says may still change is kept here, in `ATRIUM`.
|
||||
*/
|
||||
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
||||
import { join, resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { PRODUCT_NAME, PRODUCT_SHORT_NAME } from '../../../packages/schema/src/constants.js';
|
||||
import { PACKAGE, SRC_TAURI } from './tauri.js';
|
||||
|
||||
/** What the Atrium contract fixes today and may move before its v1 (APP_CONTRACT §2.2, §7). */
|
||||
export const ATRIUM = {
|
||||
needs: { fundamentum: '>=0.7', atrium: '>=0.1' },
|
||||
/** The icon, beside the `.exe`: the shell's own 256 px icon, made from apps/rosea/public/icon.svg (a placeholder). */
|
||||
icon: { file: 'domi-icon.png', from: 'icons/128x128@2x.png' }
|
||||
} as const;
|
||||
|
||||
/** The file, relative to src-tauri/, that `tauri.windows.conf.json` bundles. */
|
||||
export const MANIFEST = 'atrium/domi-app.toml';
|
||||
|
||||
export interface DomiApp {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
readonly label: string;
|
||||
readonly version: string;
|
||||
readonly accent: string;
|
||||
readonly icon: string;
|
||||
readonly hostable: boolean;
|
||||
readonly free: boolean;
|
||||
readonly needs: { readonly fundamentum: string; readonly atrium: string };
|
||||
}
|
||||
|
||||
export function domiApp(version: string): DomiApp {
|
||||
return {
|
||||
// The Aula project and the Canalis id; it changes with the name, in the same commit.
|
||||
id: PRODUCT_SHORT_NAME.toLowerCase(),
|
||||
name: PRODUCT_NAME,
|
||||
// One plain word for what she is (atrium-adoption.md §2.4, a judgment).
|
||||
label: 'Rose',
|
||||
version,
|
||||
// --rose on the dark theme (packages/ui/src/tokens.css): Atrium Domi's window is dark, and its catalogue names
|
||||
// the same colour for Rosea (Fundamentum crates/atrium-registry/src/catalogue.rs).
|
||||
accent: '#e8899b',
|
||||
icon: ATRIUM.icon.file,
|
||||
// Day 4 waits on R1: hosted, she must keep her own window and origin, or her rose seems gone.
|
||||
hostable: false,
|
||||
// Rosea needs no licence (APP_CONTRACT §2.2: "true if your app needs no licence").
|
||||
free: true,
|
||||
needs: ATRIUM.needs
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A TOML basic string. Every value here is ours; the escape keeps a later one honest: a quote, a backslash or a
|
||||
* line break can never end the string and start a key.
|
||||
*/
|
||||
const str = (s: string): string =>
|
||||
// eslint-disable-next-line no-control-regex -- finding control characters is the point
|
||||
`"${s.replace(/[\\"\u0000-\u001f\u007f]/g, (c) =>
|
||||
c === '\\' || c === '"' ? `\\${c}` : `\\u${c.charCodeAt(0).toString(16).padStart(4, '0')}`
|
||||
)}"`;
|
||||
|
||||
export function toToml(m: DomiApp): string {
|
||||
return [
|
||||
`id = ${str(m.id)}`,
|
||||
`name = ${str(m.name)}`,
|
||||
`label = ${str(m.label)}`,
|
||||
`version = ${str(m.version)}`,
|
||||
`accent = ${str(m.accent)}`,
|
||||
`icon = ${str(m.icon)}`,
|
||||
`hostable = ${String(m.hostable)}`,
|
||||
`free = ${String(m.free)}`,
|
||||
`needs = { fundamentum = ${str(m.needs.fundamentum)}, atrium = ${str(m.needs.atrium)} }`,
|
||||
''
|
||||
].join('\n');
|
||||
}
|
||||
|
||||
/** The game's version: the installer's own (tauri.conf.json reads the same file). */
|
||||
export function gameVersion(): string {
|
||||
const pkg = JSON.parse(readFileSync(join(PACKAGE, '..', 'rosea', 'package.json'), 'utf8')) as { version: string };
|
||||
return pkg.version;
|
||||
}
|
||||
|
||||
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
||||
mkdirSync(join(SRC_TAURI, 'atrium'), { recursive: true });
|
||||
writeFileSync(join(SRC_TAURI, MANIFEST), toToml(domiApp(gameVersion())), 'utf8');
|
||||
console.log(`domi-app.toml: written for Atrium Domi (${MANIFEST})`);
|
||||
}
|
||||
Reference in New Issue
Block a user