Files
DeepTutor/web/scripts/build-brand-icons.mts
Bingxi Zhao (Frank) 740ec413a0 release: v1.5.7
Per-account MCP Services and CLI Apps — the two ways a deployment plugs in
tools DeepTutor never shipped — plus the isolation that makes them safe on a
shared install.

- MCP Services: a 45-entry curated store of hosted servers each account
  installs for itself, OAuth 2.1 (PKCE + dynamic client registration) for the
  servers that require it, static keys held by reference and resolved in memory
  at connect time, stdio refused for self-service. Settings no longer
  configures MCP; /settings/mcp redirects to the store.
- CLI Apps: 101 tools snapshotted from the two CLI-Anything registries.
  Installs are admin-only, the registry's install_cmd is parsed into an argv we
  build rather than executed, npm install scripts are forced off, and 66
  first-party entries are pinned to one reviewed commit. Apps land in
  data/cli-apps, one environment each, mounted read-only into the runner.
- Credentials that authorise a person move to data/system, the one branch the
  exec sandbox never mounts: Codex tokens relocate themselves on first use
  (refusing to follow a symlink), per-user MCP configs and keys land beside
  them.
- Grants gain a cli_apps whitelist with the same deny-by-default posture as
  MCP tools; a per-turn registry view keeps one owner's provider tools out of
  the process-global registry and refuses an unauthorised tool at execute, not
  just in the manifest.
- The composer reports what filled this turn's context window, a gutter rail
  jumps back through long conversations, and the workspace collapses to a
  drawer on small screens.
- The composer keeps focus after sending and across tab switches (#720);
  released images carry provenance and SBOM attestations (#722).

README prose, all ten translated READMEs, and the docs-site pages that named
Settings → MCP are updated to match. Release notes:
assets/releases/ver1-5-7.md
2026-07-31 00:25:48 +08:00

104 lines
3.3 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Generate `lib/brand-icons.generated.ts` from `lib/brand-slugs.ts`.
*
* npm run build:brand-icons
*
* Emits only the slugs the two catalogs actually reference — the full Simple
* Icons set is ~3,450 marks and has no business in a page bundle. Fails on a
* slug that does not exist, so a typo in the curation is a build error rather
* than a mark that silently degrades to a monogram.
*
* `simple-icons` is a devDependency: it is read here, at build time, and never
* imported by the app. What ships is this script's committed output.
*/
import { writeFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import path from "node:path";
import * as simpleIcons from "simple-icons";
import { CLI_BRAND_SLUGS, MCP_BRAND_SLUGS, referencedSlugs } from "../lib/brand-slugs";
type Icon = { title: string; slug: string; hex: string; path: string };
const bySlug = new Map<string, Icon>();
for (const value of Object.values(simpleIcons as Record<string, unknown>)) {
const icon = value as Icon | undefined;
if (icon?.slug && icon.path) bySlug.set(icon.slug, icon);
}
const wanted = referencedSlugs();
const missing = wanted.filter((slug) => !bySlug.has(slug));
if (missing.length > 0) {
console.error(
`build-brand-icons: ${missing.length} slug(s) are not in simple-icons — fix lib/brand-slugs.ts:\n` +
missing.map((slug) => ` - ${slug}`).join("\n"),
);
process.exit(1);
}
const entries = wanted.map((slug) => {
const icon = bySlug.get(slug)!;
return { slug, title: icon.title, hex: icon.hex, path: icon.path };
});
const literal = (value: string) => JSON.stringify(value);
const record = (rows: Readonly<Record<string, string>>) =>
Object.entries(rows)
.sort(([a], [b]) => a.localeCompare(b))
.map(([id, slug]) => ` ${literal(id)}: ${literal(slug)},`)
.join("\n");
const output = `/**
* GENERATED by scripts/build-brand-icons.mts — do not edit.
*
* Run \`npm run build:brand-icons\` after changing lib/brand-slugs.ts.
*
* Icon paths come from the \`simple-icons\` package, which is CC0. The brands
* themselves are trademarks of their owners; the marks identify a product and
* imply no endorsement.
*/
/** One brand mark: a 24×24 path, plus the brand's own colour if ever wanted. */
export interface BrandIcon {
/** The brand's proper name, for \`aria-label\` / \`title\`. */
title: string;
/** Brand hex without the leading \`#\`. Unused by default — see BrandIcon.tsx. */
hex: string;
/** Single \`d\` attribute for a 0 0 24 24 viewBox. */
path: string;
}
export const BRAND_ICONS: Readonly<Record<string, BrandIcon>> = {
${entries
.map(
(icon) =>
` ${literal(icon.slug)}: {\n title: ${literal(icon.title)},\n hex: ${literal(icon.hex)},\n path: ${literal(icon.path)},\n },`,
)
.join("\n")}
};
/** MCP catalog entry id → slug. */
export const MCP_ICON_SLUGS: Readonly<Record<string, string>> = {
${record(MCP_BRAND_SLUGS)}
};
/** CLI app id → slug. */
export const CLI_ICON_SLUGS: Readonly<Record<string, string>> = {
${record(CLI_BRAND_SLUGS)}
};
`;
const target = path.join(
path.dirname(fileURLToPath(import.meta.url)),
"..",
"lib",
"brand-icons.generated.ts",
);
writeFileSync(target, output, "utf8");
console.log(
`build-brand-icons: ${entries.length} marks → ${path.relative(process.cwd(), target)} ` +
`(${(output.length / 1024).toFixed(1)} KB)`,
);