codex-theme-installer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInstall a Codex theme from CodexThemes
从CodexThemes安装Codex主题
Download a published theme's portable package from codexthemes.ai and unpack its source files into . This skill is standalone: its TypeScript scripts own the download, validation, and local installation. It does not search the gallery (codex-theme-finder), create themes (codex-theme-creator), or submit them (codex-theme-submitter). Applying belongs to codex-theme-switcher — but a successful install chains directly into it (Step 4); installing files and stopping is not a finished job. The only required local tools are Node.js 20+ and .
~/.codexthemes/themes/<theme-id>/npxRead before diagnosing an unexpected API response or changing endpoint behavior. Run all commands from the installed skill directory.
references/download-api.md从codexthemes.ai下载已发布主题的可移植包,并将其源文件解压到中。此技能是独立的:其TypeScript脚本负责下载、验证和本地安装。它不搜索主题库(codex-theme-finder)、创建主题(codex-theme-creator)或提交主题(codex-theme-submitter)。主题应用属于codex-theme-switcher的功能——但安装成功后会直接进入该步骤(步骤4);仅安装文件并不代表任务完成。唯一需要的本地工具是Node.js 20+和。
~/.codexthemes/themes/<theme-id>/npx在诊断意外API响应或更改端点行为之前,请阅读。所有命令均需从已安装的技能目录运行。
references/download-api.mdStep 1: identify the theme
步骤1:确定主题
Resolve what to install to a theme id — the lowercase slug from codex-theme-finder results or from a URL. The script accepts either form. If the user only describes a style without naming a theme, find candidates with codex-theme-finder first instead of guessing ids.
https://codexthemes.ai/themes/<theme-id>确定要安装的主题对应的主题ID——即codex-theme-finder结果中的小写短名称,或 URL中的部分。脚本接受这两种形式。如果用户仅描述了主题风格但未指定具体主题,请先使用codex-theme-finder查找候选主题,而非猜测ID。
https://codexthemes.ai/themes/<theme-id>Step 2: install
步骤2:安装
bash
npx tsx scripts/install-theme.ts <theme-id | codexthemes.ai theme URL> [--force]Downloads work without any API key inside a free anonymous quota, so do not demand a key up front. When a key is already configured ( environment variable or ), the script sends it automatically for higher limits.
CODEXTHEMES_API_KEY~/.codexthemes/credentials.jsonThe script validates the downloaded package (format, schema version, matching theme id, safe relative filenames, ≤30 MB) before writing anything, then unpacks , the stylesheet, the artwork, and the readme into . It refuses to overwrite an existing non-empty theme directory; pass only after the user confirms replacing their local copy — the directory may hold their own edits.
theme.json~/.codexthemes/themes/<theme-id>/--forceUpdating an installed theme: published themes are updated in place on codexthemes.ai, so when the user asks to update, upgrade, or re-download a theme they already installed, re-run the install with — the update request itself is the confirmation, unless the local copy holds edits the user made (then warn first). After the files land, continue into Step 4 so the running app actually switches to the new version; a hot swap of the same theme id re-injects the updated CSS.
--forcebash
npx tsx scripts/install-theme.ts <theme-id | codexthemes.ai theme URL> [--force]下载可在无API密钥的情况下使用免费匿名配额,因此不要一开始就要求用户提供密钥。如果已配置密钥(环境变量或文件),脚本会自动发送密钥以获得更高限制。
CODEXTHEMES_API_KEY~/.codexthemes/credentials.json脚本会先验证下载的包(格式、架构版本、主题ID匹配、安全的相对文件名、大小≤30 MB),然后再写入任何内容,接着将、样式表、图片和自述文件解压到中。它会拒绝覆盖已存在的非空主题目录;仅在用户确认替换本地副本后再使用参数——该目录可能包含用户自己的编辑内容。
theme.json~/.codexthemes/themes/<theme-id>/--force更新已安装的主题:已发布的主题会在codexthemes.ai上进行原地更新,因此当用户要求更新、升级或重新下载已安装的主题时,使用参数重新运行安装命令即可——更新请求本身即视为确认,除非本地副本包含用户自己的编辑内容(此时需先发出警告)。文件下载完成后,继续执行步骤4,以便运行中的应用实际切换到新版本;同一主题ID的热替换会重新注入更新后的CSS。
--forceStep 3: handle quota and rate limits
步骤3:处理配额和速率限制
On HTTP or the free quota is exhausted; the script's error message includes any value. Do not retry in a loop. Tell the user the free download quota is used up and guide them to configure a personal API key:
429402Retry-After- Create a key at .
https://codexthemes.ai/settings/apikeys - Store it: (stdin keeps the key out of shell history;
printf '%s' "<api-key>" | npx tsx scripts/apikey.ts setalso works).apikey.ts set <key> - Re-run the install.
Check the current key state with ; remove a stored key with . Never print a full key (scripts only show a masked form), never write it into a project file, and never commit it.
npx tsx scripts/apikey.ts statusnpx tsx scripts/apikey.ts clearOn / the configured key is invalid or revoked — guide the user to create a fresh key the same way. On the theme id does not exist; re-check the id with codex-theme-finder.
401403404当出现HTTP 或状态码时,说明免费配额已用尽;脚本的错误消息会包含值。不要循环重试。告知用户免费下载配额已用完,并指导他们配置个人API密钥:
429402Retry-After- 在创建密钥。
https://codexthemes.ai/settings/apikeys - 存储密钥:(标准输入可避免密钥出现在shell历史中;
printf '%s' "<api-key>" | npx tsx scripts/apikey.ts set同样有效)。apikey.ts set <key> - 重新运行安装命令。
使用检查当前密钥状态;使用删除已存储的密钥。切勿打印完整密钥(脚本仅显示掩码形式),切勿将其写入项目文件,也切勿提交到版本控制系统。
npx tsx scripts/apikey.ts statusnpx tsx scripts/apikey.ts clear当出现/状态码时,说明配置的密钥无效或已被撤销——以同样方式指导用户创建新密钥。当出现状态码时,说明主题ID不存在——使用codex-theme-finder重新检查ID。
401403404Step 4: activate, or hand the user the exact next reply
步骤4:激活,或告知用户下一步的明确指令
An install request means the user wants to see the theme in Codex, not merely store its files. Report the installed path (), the theme version, and the files written — then continue directly into activation with codex-theme-switcher. If codex-theme-switcher is not installed, bootstrap it the same way this skill was bootstrapped ().
~/.codexthemes/themes/<theme-id>/npx skills add codexthemes/skills --skill codex-theme-switcher -g -a codex- If Codex already exposes its debugging endpoint, hot-swap now with the switcher's and verify with
switch-theme.ts apply <theme-id>— a hot swap is reversible and needs no confirmation beyond the install request itself.switch-theme.ts status - If activation requires restarting Codex, do not restart silently and do not stop at "installed". End by telling the user the exact reply that continues, for example: "Reply and I will restart Codex to activate
apply." When they reply, follow the switcher's<theme-id>flow.--launch
Never end the conversation with only "files installed, not applied" and no actionable next step, and never claim the theme is active until the switcher's reports .
statusactive安装请求意味着用户希望在Codex中看到该主题,而不仅仅是存储其文件。报告安装路径()、主题版本和已写入的文件——然后直接使用codex-theme-switcher进行激活。如果未安装codex-theme-switcher,按照此技能的引导方式进行安装()。
~/.codexthemes/themes/<theme-id>/npx skills add codexthemes/skills --skill codex-theme-switcher -g -a codex- 如果Codex已暴露其调试端点,立即使用切换器的进行热替换,并使用
switch-theme.ts apply <theme-id>验证——热替换是可逆的,且除安装请求外无需额外确认。switch-theme.ts status - 如果激活需要重启Codex,请勿静默重启,也不要停留在“已安装”状态。最后告知用户继续操作的明确指令,例如:“回复,我将重启Codex以激活
apply。”当用户回复后,按照切换器的<theme-id>流程操作。--launch
切勿仅以“文件已安装,未应用”结束对话而不提供可执行的下一步操作,且在切换器的报告之前,切勿声称主题已激活。
statusactive