Spot it. Save it. Free, local-first Chrome extension for images, videos and prompts. Explore 2,000+ curated cases and connect your library to AI Agents via MCP. 提示词导演
JavaScript ai-artai-videochrome-extensionclaude-codecodexhiggsfieldjimenglocal-firstmcpmidjourneymoodboardprompt-engineeringprompt-libraryprompt-managerreference-libraryseedancevisual-bookmarksweb-clipper
发布 PromptDirector 1.18.7 并锁定商店身份
MigenAIb18651ec3b41
diff --git a/.gitignore b/.gitignoreindex b476674..0451122 100644--- a/.gitignore+++ b/.gitignore@@ -16,4 +16,7 @@ __pycache__/.local-imports/.scratch/.omx/-store/screenshots/+store/screenshots/*+!store/screenshots/01-library-1280x800.png+!store/screenshots/02-skills-1280x800.png+!store/screenshots/03-composer-1280x800.pngdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9d71c62..3c361ec 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,13 @@# Changelog+## 1.18.7++- 锁定 Chrome Web Store 正式扩展身份;正式打包先用项目公钥校验目标 ID,再从商店上传清单中移除仅供本地开发使用的 `key` 字段。+- 对齐中英文商店品牌名,移除超限的英文短名称,并把可选 DeepSeek 域名访问改为运行时请求。+- 补齐固定精选目录域名、Limited Use 和商店隐私字段说明,增加可重复执行的商店材料检查。+- 重建当前品牌图、宣传图和三张隔离生成的真实扩展截图。+- 修复完整浏览器回归中的图片加载、后台状态同步和扩展页刷新竞态。+## 1.18.5- 重做网页采集:先确认创作主体,再检查正文与媒体;同一列表批量采集不会进入详情页,也不会把未确认媒体静默写入案例。diff --git a/_locales/en/messages.json b/_locales/en/messages.jsonindex 6fbf2bb..d1417fb 100644--- a/_locales/en/messages.json+++ b/_locales/en/messages.json@@ -1,6 +1,5 @@{- "extensionName": { "message": "Visual Prompt Archive by 提示词导演" },- "extensionShortName": { "message": "Visual Prompt Archive" },+ "extensionName": { "message": "PromptDirector — Visual Creative Archive" },"extensionDescription": { "message": "Save web visuals with their prompts, then organize, back up, share, and reuse them in a local visual archive." },"actionTitle": { "message": "Visual Prompt Archive: capture and create" },"saveSelectionCommand": { "message": "Add highlighted text to the current capture draft" },diff --git a/_locales/zh_CN/messages.json b/_locales/zh_CN/messages.jsonindex cf5cb09..b095727 100644--- a/_locales/zh_CN/messages.json+++ b/_locales/zh_CN/messages.json@@ -1,6 +1,5 @@{- "extensionName": { "message": "提示词导演 - 视觉提示词灵感库" },- "extensionShortName": { "message": "提示词导演" },+ "extensionName": { "message": "提示词导演 - 视觉创作资料库" },"extensionDescription": { "message": "收藏网页画面与提示词,在本地视觉案例库中检索、整理、备份和分享创作灵感。" },"actionTitle": { "message": "提示词导演:收藏与创作提示词" },"saveSelectionCommand": { "message": "把当前高亮文字加入采集草稿" },diff --git a/assets/icons/icon-source.svg b/assets/icons/icon-source.svgindex 583e526..842a247 100644--- a/assets/icons/icon-source.svg+++ b/assets/icons/icon-source.svg@@ -1,4 +1,4 @@-<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128" role="img" aria-label="PromptDirector P mark">+<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128" role="img" aria-label="PromptDirector mark"><rect x="4" y="4" width="120" height="120" rx="22" fill="#D1FE17"/><path d="M30 25h48c19 0 32 12 32 30 0 14-7 25-20 31L70 69c9-2 14-7 14-14 0-8-6-13-16-13H25l5-17Z" fill="#0F1113"/><path d="m29 63 25 20-9 26H18l11-46Z" fill="#0F1113"/>diff --git a/curated-catalog.js b/curated-catalog.jsindex 6c74308..166ca60 100644--- a/curated-catalog.js+++ b/curated-catalog.js@@ -10,6 +10,7 @@ export const CURATED_METRICS_FORMAT = "prompt-director-curated-metrics";export const CURATED_METRICS_VERSION = 1;const TYPES = new Set(["editorial", "image_prompt", "video_prompt"]);+const VERIFIED_RIGHTS_STATUSES = new Set(["verified_original", "verified_authorized"]);const COVER_HOSTS = new Set(["wchao6891.github.io"]);const DOWNLOAD_HOSTS = new Set(["github.com",@@ -60,6 +61,8 @@ export function applyCuratedOrigin(entryValue, itemValue, installedAt = new DatepackageVersion: item.packageVersion,author: item.author,license: item.license,+ rightsStatus: item.rightsStatus,+ rightsReviewUrl: item.rightsReviewUrl,sourceEntryId,installedAt: validIso(installedAt) || new Date().toISOString()}@@ -304,12 +307,14 @@ function normalizeItem(value = {}) {const type = TYPES.has(value.type) ? value.type : "";const author = clean(value.author);const license = clean(value.license);+ const rightsStatus = clean(value.rightsStatus);+ const rightsReviewUrl = trustedUrl(value.rightsReviewUrl, COVER_HOSTS, "精选权利审核地址不受信任");const updatedAt = validIso(value.updatedAt);const coverUrl = trustedUrl(value.coverUrl, COVER_HOSTS, "精选封面地址不受信任");const previewUrl = trustedUrl(value.previewUrl, COVER_HOSTS, "精选预览地址不受信任");const downloadUrl = trustedUrl(value.downloadUrl, DOWNLOAD_HOSTS, "精选下载地址不受信任");const sha256 = String(value.sha256 ?? "").toLocaleLowerCase("en-US");- if (!id || !title || !type || !packageId || !packageVersion || !authorId || !author || !license || !updatedAt ||+ if (!id || !title || !type || !packageId || !packageVersion || !authorId || !author || !license || !VERIFIED_RIGHTS_STATUSES.has(rightsStatus) || !updatedAt ||!/^[a-f0-9]{64}$/.test(sha256)) {throw new Error("精选目录条目缺少必填字段或校验值");}@@ -322,6 +327,8 @@ function normalizeItem(value = {}) {authorId,author,license,+ rightsStatus,+ rightsReviewUrl,updatedAt,coverUrl,previewUrl,diff --git a/manifest.json b/manifest.jsonindex 20beb57..c1a1aef 100644--- a/manifest.json+++ b/manifest.json@@ -1,8 +1,8 @@{"manifest_version": 3,"name": "__MSG_extensionName__",- "short_name": "__MSG_extensionShortName__",- "version": "1.18.5",+ "version": "1.18.7",+ "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq2m8W9ACXJTkJqPAd36sPrtzonmHhOYU34uS7c+D7DXX6ggWNMwB4xZapGFJ4ScBQJv71PeG9KfsEnhcXFZ9RoX/X3wY+57evL19hf6woNX1xxhKOe1rtx5QmzWCEYIr99TzW50k/N9U6tS9Ri+2DHKYA85ssXTC8B2yRQ5zUXhsAWZe/HDU18UFuvUKXYt3ZdIUi31c2vIlgFFBfsyKbIUMny9LlxL/smb4vJzU/+A3LwJDjjvOtS/lmQ2vHoQGjHJItO18bYI6h67fIEvmWk+HJKtO08Ca+5RLS8TYhI+K7l7S0RyDVNujyVWtvhAULot1H0BvteYL87fKu3SNywIDAQAB","homepage_url": "https://github.com/wchao6891/PromptDirector","default_locale": "zh_CN","minimum_chrome_version": "116",@@ -25,7 +25,6 @@"unlimitedStorage"],"host_permissions": [- "https://api.deepseek.com/*","https://wchao6891.github.io/*","https://github.com/*","https://objects.githubusercontent.com/*",diff --git a/package-lock.json b/package-lock.jsonindex 0ff40f0..85c53f5 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,12 +1,12 @@{"name": "prompt-case-collector",- "version": "1.18.5",+ "version": "1.18.7","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "prompt-case-collector",- "version": "1.18.5",+ "version": "1.18.7","license": "Apache-2.0","dependencies": {"@jonahschulte/rtf-toolkit": "0.5.0",diff --git a/package.json b/package.jsonindex daaf22d..cd98d4e 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "prompt-case-collector",- "version": "1.18.5",+ "version": "1.18.7","private": false,"license": "Apache-2.0","repository": "https://github.com/wchao6891/PromptDirector",@@ -10,17 +10,19 @@"build:documents": "node tools/document-runtime.mjs","build:icons": "node tools/build-ui-icons.mjs","build:pdfjs": "node tools/pdfjs-runtime.mjs",+ "build:store": "node tools/build-store-assets.mjs","test": "node --test","check": "node tools/check-source.mjs","check:public": "node tools/validate-public-source.mjs","check:brand": "node tools/build-brand-icons.mjs --check","check:documents": "node tools/document-runtime.mjs --check","check:pdfjs": "node tools/pdfjs-runtime.mjs --check",+ "check:store": "node tools/build-store-assets.mjs --check && node tools/check-store-readiness.mjs","package": "npm run build:brand && npm run build:documents && npm run build:icons && node tools/package-extension.mjs","package:release": "npm run build:brand && npm run build:documents && npm run build:icons && node tools/package-extension.mjs --release","test:e2e": "python3 test/run_e2e.py","test:smart-picker": "python3 test/smart_visual_picker_e2e.py",- "verify": "npm run check:public && npm run check && npm run check:brand && npm run check:documents && npm run check:pdfjs && npm test && npm run package"+ "verify": "npm run check:public && npm run check && npm run check:brand && npm run check:documents && npm run check:pdfjs && npm run check:store && npm test && npm run package:release"},"dependencies": {"@jonahschulte/rtf-toolkit": "0.5.0",diff --git a/store/CHROME_WEB_STORE_SUBMISSION.md b/store/CHROME_WEB_STORE_SUBMISSION.mdnew file mode 100644index 0000000..09e2590--- /dev/null+++ b/store/CHROME_WEB_STORE_SUBMISSION.md@@ -0,0 +1,100 @@+# Chrome Web Store submission worksheet++This file is the source-of-truth worksheet for the current PromptDirector manifest. Do not submit a package if `npm run check:store` or the full browser suite is red.++## Stable Web Store identity++- Chrome Web Store item public key: stored in the source `manifest.json` for local identity verification only; `package:release` removes `key` from the upload manifest.+- Expected extension ID: `iahakaahijddcjjldidbclicedibgpjm`.+- Current release candidate: `dist/PromptDirector-1.18.7.zip`.+- Candidate size: `8,124,631` bytes.+- Candidate SHA-256: `92b51bbe253b29a41e7e9869dd6d9d643812d16452a24e5e9140375f26d7e516`.+- Generate a candidate only with `npm run package:release`; the command verifies the source public key against the expected identity, then removes `key` from the Web Store upload manifest.++## Store listing++- Chinese copy: `store/LISTING_ZH_CN.md`+- English copy: `store/LISTING_EN.md`+- Public privacy policy URL: `https://wchao6891.github.io/PromptDirector-Curated/privacy.html`+- Homepage URL: `https://wchao6891.github.io/PromptDirector-Curated/`+- Support URL: `https://github.com/wchao6891/PromptDirector-Curated/issues`+- 128x128 icon: `assets/icons/icon-128.png`+- 440x280 small promo tile: `store/small-promo-440x280.png`+- Screenshots, in order:+ 1. `store/screenshots/01-library-1280x800.png`+ 2. `store/screenshots/02-skills-1280x800.png`+ 3. `store/screenshots/03-composer-1280x800.png`++## Single purpose++Help visual creators capture web visuals with their prompts, media, and notes as a searchable, reusable local creative archive.++Chinese Dashboard value:++> 帮助视觉创作者在用户主动操作下,将网页画面、提示词、媒体和笔记保存为可检索、可复用的本地创作资料,并以这些资料创建创作 Skill 和提示词。++## Permission justifications++- `activeTab`: read only the page on which the user explicitly starts capture, visual selection, or a screenshot action.+- `alarms`: schedule, poll, pause, and resume local background jobs without tracking browsing.+- `contextMenus`: expose the user-triggered right-click capture command.+- `downloads`: save backups, share packages, or media files requested by the user.+- `offscreen`: process screenshots, media, documents, and ZIP archives locally in a short-lived background document.+- `sidePanel`: provide the capture and creation workspace in Chrome's side panel.+- `scripting`: inject bounded capture or selection code only after the user starts that operation.+- `storage`: store the user's local cases, projects, settings, and task state.+- `unlimitedStorage`: retain the images, videos, and documents the user explicitly saves to the local archive.+- `https://wchao6891.github.io/*`: read the official PromptDirector curated catalog, metrics, covers, and previews.+- `https://github.com/*`: read a curated GitHub Release selected by the user and open public feedback or submission pages.+- `https://objects.githubusercontent.com/*`: follow GitHub's Release download path for selected curated content.+- `https://release-assets.githubusercontent.com/*`: download selected curated Release archives and media after integrity checks.+- Optional `<all_urls>`: request only the exact site or AI-service origin needed after the user starts or configures that feature; it is not granted at installation.+- Optional `clipboardRead`: read clipboard content only when the user triggers the relevant action.+- Optional `declarativeNetRequestWithHostAccess`: create bounded media-read rules only on origins the user already granted.++## Chinese permission justifications++- Host permissions: 固定的 GitHub Pages 与 GitHub 域名仅用于读取官方精选目录、封面、审核记录及用户选择下载的精选 Release 包。其他网站和 AI 服务使用可选 `<all_urls>`,只在用户主动采集或配置服务时请求具体来源;不在安装时获得全网访问,也不后台浏览网页。+- `activeTab`: 用户点击扩展、右键菜单、选图或截图后,临时读取当前标签页中的用户可见内容并完成该次采集。不会被动访问其他标签页或后台记录浏览。+- `alarms`: 用于安排、轮询、暂停和恢复用户已启动的本地后台任务,使服务工作器休眠后仍可继续;不用于追踪浏览活动。+- `clipboardRead`: 仅当用户点击从剪贴板提取文字或图片的明确动作时,请求可选权限并读取本次剪贴板内容;不在后台持续读取。+- `contextMenus`: 在网页右键菜单提供用户主动触发的收藏入口,将选中文字或当前页面内容送入本地采集流程。+- `declarativeNetRequestWithHostAccess`: 仅在用户已授予具体站点访问权限、且保存已确认媒体需要调整该次资源请求时,创建范围受限的临时规则;不拦截或修改无关网站流量。+- `downloads`: 将用户明确要求的资料备份、分享包或媒体文件保存到本机下载目录;不会自动下载未知文件。+- `offscreen`: 在短期离屏文档中完成需要 DOM 或 Canvas 的本地处理,例如截图裁剪、缩略图、媒体或文档解析和 ZIP 处理;不显示广告、不追踪用户。+- `scripting`: 仅在用户主动启动网页采集、智能选图或截图时,向当前页面注入随扩展打包的采集或选择脚本;不执行远程代码,不对未授权页面持续注入。+- `sidePanel`: 在 Chrome 侧边栏提供采集、整理和创作工作区,使用户在当前网页旁预览并确认要保存的内容。+- `storage`: 在浏览器扩展本地存储中保存用户的案例、项目、标签、设置、任务状态和用户配置的 AI 服务信息;默认不上传开发者服务器。+- `unlimitedStorage`: 用户可能主动保存大量图片、视频和文档,标准配额不足以可靠保留完整本地创作资料库;权限只用于用户选择保存的本地内容。++## Privacy practices++- Remote code: **No, the extension does not use remote code.** Remote JSON, media, curated archives, and AI responses are treated as data and are never executed as extension code.+- User data: disclose website content and resources, saved source URLs/browsing activity, user-provided prompts/notes/media, and locally stored AI-service authentication information. These categories are handled even when they remain on-device.+- Data transfer: user-selected content is sent only to the AI service or compatible endpoint selected and authorized by the user. Curated catalog and Release requests contain no private library data.+- Limited Use: certify all applicable statements. There is no sale of user data, personalized advertising, analytics collection, or developer-operated content server.++Chinese remote-code declaration:++> 不使用远程代码。所有可执行 JavaScript、CSS、PDF 与文档解析器和 ZIP 逻辑均随扩展包提供。远程 JSON、媒体、精选包和 AI 响应只作为经过校验的数据处理,绝不作为代码执行。++Data types handled, including local-only handling:++- Authentication information: user-configured AI API keys and sending authorization.+- Web browsing activity: source URLs and origins involved in a user-triggered capture.+- Website content and resources: user-selected text, images, videos, documents, and screenshots.+- User-generated content: prompts, notes, cases, projects, tags, Skills, and creative requests.++Do not select personally identifiable information, health information, financial or payment information, location, personal communications, or generic user activity; PromptDirector does not intentionally handle these as product data.++## Final local gate++Run, in order:++```text+npm run verify+npm run test:e2e+npm run package:release+```++Then load the exact release candidate in a clean Chrome profile and visibly verify capture, library search/read-back, Skill creation, Composer, backup/restore, and extension identity before submitting for review.diff --git a/store/PRIVACY_POLICY.md b/store/PRIVACY_POLICY.mdindex c9a71af..be5eedc 100644--- a/store/PRIVACY_POLICY.md+++ b/store/PRIVACY_POLICY.md@@ -42,6 +42,10 @@本地数据会保留,直到用户在案例库中修改或删除、清除扩展数据,或卸载扩展。用户可在卸载前创建本地备份,并可在 AI 服务连接设置中清除本地 API Key 和发送授权。+## Chrome Web Store Limited Use++提示词导演对用户数据的使用遵守 Chrome Web Store User Data Policy 的 Limited Use 要求:权限和用户数据只用于提供或改进本政策所述、用户可见的单一用途与功能;不会将用户数据用于个性化广告、再营销或基于兴趣的广告;不会出售用户数据;不会允许人工读取用户数据,除非用户为解决其明确提出的支持请求而对特定内容另行授权,或法律与安全义务确有要求。+## 权限用途- `activeTab`:仅在用户主动触发的当前标签页操作中访问页面内容;用户明确启动列表批量采集时,可在同一标签页内滚动或沿列表分页继续,并在结束后返回原列表页。@@ -52,11 +56,62 @@- `sidePanel`:在 Chrome 侧边栏显示扩展的收藏与创作界面。- `scripting`:仅在用户主动启动采集、选图或截图工具时向当前页面注入所需脚本。- `storage` 与 `unlimitedStorage`:保存用户主动收藏的资料、媒体、设置和本地 AI 服务配置。-- `https://api.deepseek.com/*`:用于用户主动配置、授权并发起的 DeepSeek 请求。+- `https://wchao6891.github.io/*`:读取 PromptDirector 官方精选目录、目录指标、封面和只读预览数据。+- `https://github.com/*`:读取用户明确选择保存的官方精选 Release 包,并打开公开的问题反馈或投稿页面。+- `https://objects.githubusercontent.com/*` 与 `https://release-assets.githubusercontent.com/*`:跟随 GitHub Release 的受信下载链读取用户明确选择的精选包及其媒体;不会读取其他 GitHub 账号数据。- 可选的 `<all_urls>`:不在安装时授予。只有用户主动使用需要相应站点权限的采集功能或保存第三方 AI 服务、自定义兼容接口时,扩展才会请求相应域名的运行时权限。- 可选的 `clipboardRead`:只在用户明确触发需要读取剪贴板内容的功能时请求。- 可选的 `declarativeNetRequestWithHostAccess`:只在用户已授予相应站点访问权限、且功能需要按该权限处理网络请求时使用。## 联系方式-请通过 [GitHub Issues](https://github.com/wchao6891/PromptDirector/issues) 联系项目维护者。+请通过 [PromptDirector 精选案例 GitHub Issues](https://github.com/wchao6891/PromptDirector-Curated/issues) 联系项目维护者。++---++# PromptDirector Privacy Policy++Effective date: August 16, 2026++PromptDirector is a local-first Chrome extension for collecting, organizing, searching, backing up, and sharing personal creative references. It has no developer-operated data server or user account system, does not collect analytics, does not show ads, and does not sell user data.++## Data handled++PromptDirector handles data only when the user explicitly captures, imports, exports, analyzes, generates, or composes with it. This can include selected website text and resources, source URLs and attribution, screenshots, user prompts and notes, projects, tags, Creative Skills, settings, and credentials for AI services chosen by the user.++Cases, media, tags, settings, Creative Skills, and API keys are stored in the browser's local extension storage by default. Image processing, document extraction, archive creation, and offline previews run locally. API keys are excluded from exports, shared packages, drafts, diagnostics, and logs.++## Optional external services++PromptDirector supports seven separately assigned AI tasks: text tagging, Skill extraction, creative planning, image analysis, video analysis, image generation, and video generation. No external AI request runs merely because the extension is installed. A real request requires the configured service, model, required site permission, and the user's sending consent. Paid media analysis or generation also requires a separate confirmation for the current action.++Only content selected or submitted for the current operation is sent directly over HTTPS to the AI provider or compatible endpoint chosen by the user. PromptDirector does not silently send the full library, unselected cases, API keys, or retry a paid action through another provider. In text-only creation mode, images are neither read nor transmitted. The developer does not receive or proxy AI request content; each provider handles received data under its own terms and privacy policy.++## Sharing, retention, and deletion++Data leaves local storage only when the user explicitly sends it to a configured AI service, exports or migrates it, or creates and distributes a share package. Local data remains until the user edits or deletes it, clears extension storage, or uninstalls the extension. Users can create a local backup before uninstalling and can remove locally saved API keys and consent in AI service settings.++## Chrome Web Store Limited Use++PromptDirector complies with the Limited Use requirements of the Chrome Web Store User Data Policy. Permissions and user data are used only to provide or improve the disclosed, user-facing single purpose and features. User data is not sold or used for personalized, retargeted, or interest-based advertising. Humans are not allowed to read user data unless the user separately authorizes access to specific content for a support request, or access is required for security or legal obligations.++## Permission purposes++- `activeTab`: access the current page only after a user starts capture, visual selection, or another page action.+- `alarms`: schedule or resume local background work; never for tracking.+- `contextMenus`: provide the explicit right-click capture entry.+- `downloads`: save a user-requested backup, share package, or media file.+- `offscreen`: perform local screenshot, media, document, or ZIP work that needs a background document.+- `sidePanel`: show capture and creation controls in the Chrome side panel.+- `scripting`: inject the required capture, selection, or screenshot code only after a user starts that action.+- `storage` and `unlimitedStorage`: retain the user's selected references, media, settings, and local AI configuration.+- `https://wchao6891.github.io/*`: read the official curated catalog, metrics, covers, and read-only previews.+- `https://github.com/*`: read an official curated Release package selected by the user and open public feedback or submission pages.+- `https://objects.githubusercontent.com/*` and `https://release-assets.githubusercontent.com/*`: follow GitHub's trusted Release download chain for a curated package and its media selected by the user; no other GitHub account data is read.+- Optional `<all_urls>`: not granted at installation. PromptDirector requests only the specific origin needed when the user starts a site-dependent capture or saves a third-party or compatible AI endpoint.+- Optional `clipboardRead`: requested only for a user-triggered feature that reads clipboard content.+- Optional `declarativeNetRequestWithHostAccess`: requested only when a user-granted site permission and the chosen feature require a bounded network rule.++## Contact++Contact the maintainer through [PromptDirector Curated GitHub Issues](https://github.com/wchao6891/PromptDirector-Curated/issues).diff --git a/store/brand/prompt-director-mark-source.png b/store/brand/prompt-director-mark-source.pngindex d498255..9012035 100644Binary files a/store/brand/prompt-director-mark-source.png and b/store/brand/prompt-director-mark-source.png differdiff --git a/store/brand/prompt-director-promo-source.png b/store/brand/prompt-director-promo-source.pngindex cefb315..82e7203 100644Binary files a/store/brand/prompt-director-promo-source.png and b/store/brand/prompt-director-promo-source.png differdiff --git a/store/brand/prompt-director-promo-source.svg b/store/brand/prompt-director-promo-source.svgnew file mode 100644index 0000000..0ea715b--- /dev/null+++ b/store/brand/prompt-director-promo-source.svg@@ -0,0 +1,15 @@+<svg xmlns="http://www.w3.org/2000/svg" width="440" height="280" viewBox="0 0 440 280" role="img" aria-label="PromptDirector store promotional artwork">+ <rect width="440" height="280" rx="0" fill="#F4F5F0"/>+ <rect x="28" y="67" width="146" height="146" rx="27" fill="#D1FE17"/>+ <path d="M72 100h55c22 0 37 14 37 35 0 16-8 29-23 36l-23-20c10-2 16-8 16-16 0-9-7-15-18-15H66l6-20Z" fill="#0F1113"/>+ <path d="m71 144 29 23-10 30H59l12-53Z" fill="#0F1113"/>+ <rect x="210" y="42" width="194" height="72" rx="12" fill="#0F1113"/>+ <rect x="224" y="56" width="79" height="44" rx="7" fill="#D1FE17"/>+ <rect x="315" y="58" width="72" height="8" rx="4" fill="#F4F5F0"/>+ <rect x="315" y="74" width="54" height="7" rx="3.5" fill="#A7ABA2"/>+ <rect x="315" y="89" width="42" height="7" rx="3.5" fill="#686D66"/>+ <rect x="210" y="128" width="194" height="110" rx="12" fill="#FFFFFF" stroke="#D9DDD5"/>+ <rect x="224" y="143" width="50" height="80" rx="7" fill="#1A1D20"/>+ <rect x="282" y="143" width="50" height="80" rx="7" fill="#D1FE17"/>+ <rect x="340" y="143" width="50" height="80" rx="7" fill="#AEB3AA"/>+</svg>diff --git a/store/screenshots/01-library-1280x800.png b/store/screenshots/01-library-1280x800.pngnew file mode 100644index 0000000..f57ae88Binary files /dev/null and b/store/screenshots/01-library-1280x800.png differdiff --git a/store/screenshots/02-skills-1280x800.png b/store/screenshots/02-skills-1280x800.pngnew file mode 100644index 0000000..08f8096Binary files /dev/null and b/store/screenshots/02-skills-1280x800.png differdiff --git a/store/screenshots/03-composer-1280x800.png b/store/screenshots/03-composer-1280x800.pngnew file mode 100644index 0000000..2e247cfBinary files /dev/null and b/store/screenshots/03-composer-1280x800.png differdiff --git a/store/small-promo-440x280.png b/store/small-promo-440x280.pngindex 4255daa..589ce0a 100644Binary files a/store/small-promo-440x280.png and b/store/small-promo-440x280.png differdiff --git a/test/chrome-store-manifest.test.js b/test/chrome-store-manifest.test.jsnew file mode 100644index 0000000..831349c--- /dev/null+++ b/test/chrome-store-manifest.test.js@@ -0,0 +1,56 @@+import test from "node:test";+import assert from "node:assert/strict";++import { validateChromeStoreManifest } from "../tools/chrome-store-manifest.mjs";++const locales = {+ zh_CN: {+ extensionName: { message: "提示词导演 - 视觉提示词灵感库" },+ extensionDescription: { message: "收藏网页画面与提示词。" }+ },+ en: {+ extensionName: { message: "PromptDirector — Visual Creative Archive" },+ extensionDescription: { message: "Save web visuals with their prompts." }+ }+};++test("localized store manifest fields accept current names without a separate short name", () => {+ assert.doesNotThrow(() => validateChromeStoreManifest({+ manifest: {+ manifest_version: 3,+ version: "1.18.6",+ name: "__MSG_extensionName__",+ description: "__MSG_extensionDescription__"+ },+ locales+ }));+});++test("localized short names cannot exceed Chrome's twelve-character limit", () => {+ assert.throws(() => validateChromeStoreManifest({+ manifest: {+ manifest_version: 3,+ version: "1.18.6",+ name: "__MSG_extensionName__",+ short_name: "__MSG_extensionShortName__",+ description: "__MSG_extensionDescription__"+ },+ locales: {+ ...locales,+ en: { ...locales.en, extensionShortName: { message: "Visual Prompt Archive" } },+ zh_CN: { ...locales.zh_CN, extensionShortName: { message: "提示词导演" } }+ }+ }), /short_name.*12/);+});++test("every locale must resolve the store-facing manifest messages", () => {+ assert.throws(() => validateChromeStoreManifest({+ manifest: {+ manifest_version: 3,+ version: "1.18.6",+ name: "__MSG_extensionName__",+ description: "__MSG_extensionDescription__"+ },+ locales: { ...locales, en: { extensionName: locales.en.extensionName } }+ }), /extensionDescription/);+});diff --git a/test/creative_skills_e2e.py b/test/creative_skills_e2e.pyindex 98a6f0a..8ac9068 100644--- a/test/creative_skills_e2e.py+++ b/test/creative_skills_e2e.py@@ -305,13 +305,12 @@ Run `scripts/helper.py` before applying the composition guidance.expect(skills.locator("#skill-export")).to_have_count(1)skills.locator("#skill-context-back").click()+ skills.evaluate("""async () => chrome.storage.local.set({+ uiPreferences: { locale: 'zh-CN', theme: 'dark', motion: 'none' }+ })""")skills.goto(composer_url, wait_until="domcontentloaded")composer = skillscomposer.set_viewport_size({"width": 1840, "height": 900})- composer.evaluate("""async () => chrome.storage.local.set({- uiPreferences: { locale: 'zh-CN', theme: 'dark', motion: 'none' }- })""")- composer.reload(wait_until="domcontentloaded")composer.locator("#composer-reference-open").click()composer.locator("#composer-reference-tab-skills").click()expect(composer.locator("#composer-projects-panel")).to_be_visible()diff --git a/test/curated-catalog.test.js b/test/curated-catalog.test.jsindex fba7473..1ee383d 100644--- a/test/curated-catalog.test.js+++ b/test/curated-catalog.test.js@@ -24,6 +24,8 @@ function catalogItem(overrides = {}) {authorId: "promptdirector-editorial",author: "PromptDirector Editorial",license: "CC BY 4.0",+ rightsStatus: "verified_authorized",+ rightsReviewUrl: "https://wchao6891.github.io/PromptDirector-Curated/reviews/cinematic-foundations.json",updatedAt: "2026-07-29T00:00:00.000Z",coverUrl: "https://wchao6891.github.io/PromptDirector-Curated/covers/cinematic.webp",previewUrl: "https://wchao6891.github.io/PromptDirector-Curated/previews/cinematic-foundations/preview.json",@@ -57,6 +59,11 @@ test("curated catalogs expose ordered themes with trusted package assets", () =>version: 2,themes: [catalogItem({ sha256: "not-a-checksum" })]}), /校验值/);+ assert.throws(() => normalizeCuratedCatalog({+ format: "prompt-director-curated",+ version: 2,+ themes: [catalogItem({ rightsStatus: "unverified" })]+ }), /缺少必填字段/);assert.throws(() => normalizeCuratedCatalog({format: "prompt-director-curated",version: 1,@@ -147,6 +154,8 @@ test("installing a curated package records provenance without retaining servicepackageVersion: item.packageVersion,author: item.author,license: item.license,+ rightsStatus: item.rightsStatus,+ rightsReviewUrl: item.rightsReviewUrl,sourceEntryId: "case:one",installedAt: "2026-07-29T01:00:00.000Z"});diff --git a/test/curated-import.test.js b/test/curated-import.test.jsindex fea4bb3..e132abd 100644--- a/test/curated-import.test.js+++ b/test/curated-import.test.js@@ -16,6 +16,8 @@ function item(version) {authorId: "editorial",author: "PromptDirector 编辑精选",license: "测试权利",+ rightsStatus: "verified_authorized",+ rightsReviewUrl: "https://wchao6891.github.io/PromptDirector-Curated/reviews/test-pack.json",updatedAt: "2026-08-14T00:00:00.000Z",coverUrl: "https://wchao6891.github.io/PromptDirector-Curated/covers/test.webp",previewUrl: "https://wchao6891.github.io/PromptDirector-Curated/previews/test/preview.json",diff --git a/test/curated_live_release_e2e.py b/test/curated_live_release_e2e.pyindex 6a30510..49e0d01 100644--- a/test/curated_live_release_e2e.py+++ b/test/curated_live_release_e2e.py@@ -22,17 +22,19 @@ def main() -> None:"async (url) => (await fetch(url, {cache: 'no-store', credentials: 'omit'})).json()",CATALOG_URL,)- item = min(catalog["themes"], key=lambda candidate: candidate["caseCount"])+ assert len(catalog["themes"]) == 1, catalog+ item = catalog["themes"][0]+ assert item["id"] == "featured:vol-1", item+ assert item["caseCount"] == 20, item+ assert item["rightsStatus"] == "verified_original", item+ assert item["rightsReviewUrl"].endswith("/reviews/featured-cases-vol-1.json"), itemcard = curated.locator(f'.pack-card[data-pack-id="{item["id"]}"]')expect(card).to_be_visible(timeout=30_000)card.click()expect(curated.locator(".case-card").first).to_be_visible(timeout=30_000)- expect(curated.locator(".case-video-badge").first).to_be_visible()- curated.locator(".case-card").first.hover()- expect(curated.locator(".case-card").first.locator(".case-video-preview")).to_have_count(1)+ expect(curated.locator(".case-video-badge")).to_have_count(0)curated.locator(".case-card").first.click()- expect(curated.locator(".case-detail-video")).to_have_count(1)- curated.wait_for_function("() => document.querySelector('.case-detail-video')?.readyState >= 1", timeout=30_000)+ expect(curated.locator(".case-detail-figure img")).to_have_count(1)save = curated.locator(".case-save-action")expect(save).to_have_text("保存到案例库")curated.evaluate(@@ -65,7 +67,7 @@ def main() -> None:print({"save_timeout": diagnostics, "page_errors": page_errors, "console_errors": console_errors})raiseexpect(curated.locator("#detail-drawer")).to_have_class(re.compile(r"\bopen\b"))- expect(curated.locator(".detail-video")).to_have_count(1)+ expect(curated.locator(".detail-image")).to_have_count(1)local_state = curated.evaluate("async () => chrome.runtime.sendMessage({type: 'GET_STATE'})")assert len(local_state["entries"]) == 1, local_statelabels = curated.evaluate("async () => (await chrome.storage.local.get('__curatedLiveLabels')).__curatedLiveLabels || []")@@ -90,7 +92,8 @@ def main() -> None:print({"package": item["id"],"case_count": item["caseCount"],- "online_video": True,+ "rights_status": item["rightsStatus"],+ "online_video": False,"opened_saved_case": True,"progress": labels,"saved_entries": len(local_state["entries"]),diff --git a/test/curated_video_workflow_e2e.py b/test/curated_video_workflow_e2e.pyindex 5b46242..148d5ea 100644--- a/test/curated_video_workflow_e2e.py+++ b/test/curated_video_workflow_e2e.py@@ -74,6 +74,8 @@ def main() -> None:"authorId": "author-video-editorial","author": "视频作者","license": "权利归原作者",+ "rightsStatus": "verified_authorized",+ "rightsReviewUrl": "https://wchao6891.github.io/PromptDirector-Curated/reviews/video-workflow.json","updatedAt": "2026-08-10T00:00:00.000Z","coverUrl": COVER_URL,"previewUrl": PREVIEW_URL,diff --git a/test/curated_workflow_e2e.py b/test/curated_workflow_e2e.pyindex 3c1df25..f487533 100644--- a/test/curated_workflow_e2e.py+++ b/test/curated_workflow_e2e.py@@ -71,6 +71,8 @@ def main() -> None:"authorId": "author-editorial","author": "PromptDirector 编辑精选","license": "权利归原作者",+ "rightsStatus": "verified_authorized",+ "rightsReviewUrl": "https://wchao6891.github.io/PromptDirector-Curated/reviews/workflow.json","updatedAt": "2026-08-08T00:00:00.000Z","coverUrl": COVER_URL,"previewUrl": PREVIEW_URL,@@ -221,6 +223,12 @@ def main() -> None:curated.locator("#case-detail-next").click()expect(curated.locator(".case-detail-heading h2")).to_have_text("竖版工作流案例")+ curated.wait_for_function(+ """() => {+ const image = document.querySelector('.case-detail-figure img');+ return image?.complete && image.naturalWidth > 0 && image.naturalHeight > 0;+ }"""+ )portrait = curated.locator(".case-detail-figure img").evaluate("img => ({natural: img.naturalWidth / img.naturalHeight, rendered: img.getBoundingClientRect().width / img.getBoundingClientRect().height})")diff --git a/test/page_capture_e2e.py b/test/page_capture_e2e.pyindex 2377dbb..0556577 100644--- a/test/page_capture_e2e.py+++ b/test/page_capture_e2e.py@@ -38,6 +38,7 @@ GIF = bytes.fromhex()PDF = b"%PDF-1.4\n1 0 obj\n<< /Type /Catalog >>\nendobj\n%%EOF"+FIXTURE_ORIGIN = "https://wchao6891.github.io"def list_page(page: int) -> bytes:@@ -54,7 +55,7 @@ def list_page(page: int) -> bytes:def main() -> None:with extension_session("prompt-director-page-capture-") as run:- fixture_url = "https://api.deepseek.com/promptdirector-capture-fixture"+ fixture_url = f"{FIXTURE_ORIGIN}/promptdirector-capture-fixture"def route_fixture(route) -> None:request_url = route.request.urlif request_url.endswith("/deferred-original.png"):@@ -78,7 +79,7 @@ def main() -> None:content_type="text/html; charset=utf-8" if request_url == fixture_url else "image/png",)- run.context.route("https://api.deepseek.com/**", route_fixture)+ run.context.route(f"{FIXTURE_ORIGIN}/**", route_fixture)collector = run.open_page("collector.html", wait_until="networkidle")run.seed_storage(collector, {"schemaVersion": 24, "entries": []})fixture = run.context.new_page()@@ -203,7 +204,7 @@ def main() -> None:assert selected_saved[0]["sourceFacts"]["captureScope"] == "selection", selected_saved[0]collector.evaluate("() => chrome.storage.local.set({entries: []})")- list_url = "https://api.deepseek.com/promptdirector-list?page=1"+ list_url = f"{FIXTURE_ORIGIN}/promptdirector-list?page=1"fixture.goto(list_url, wait_until="networkidle")fixture.bring_to_front()collector.evaluate("() => document.querySelector('#start-page-capture').click()")@@ -244,7 +245,7 @@ def main() -> None:assert combined_saved[0]["title"] == "Combined list inspiration", combined_saved[0]assert len(combined_saved[0].get("mediaAssets", [])) == 3, combined_saved[0]assert {asset.get("originalWorkUrl") for asset in combined_saved[0]["mediaAssets"]} == {- "https://api.deepseek.com/work/1", "https://api.deepseek.com/work/2", "https://api.deepseek.com/work/3"+ f"{FIXTURE_ORIGIN}/work/1", f"{FIXTURE_ORIGIN}/work/2", f"{FIXTURE_ORIGIN}/work/3"}, combined_saved[0]print({"previewCandidates": 2, "mediaViewerItems": 5, "confirmedSubjects": 1, "savedWholeCaseMedia": 6, "savedLiveSelectionMedia": 0, "paginatedCases": 3, "combinedCases": 1, "clearedPageMarkers": 1})diff --git a/test/privacy-policy.test.js b/test/privacy-policy.test.jsindex bc6ce61..d2974ac 100644--- a/test/privacy-policy.test.js+++ b/test/privacy-policy.test.js@@ -46,10 +46,20 @@ test("privacy policy accurately declares local-first handling and manifest permifor (const permission of [...manifest.permissions, ...manifest.optional_permissions]) {assert.match(policy, new RegExp("`" + permission + "`"), `policy must disclose ${permission}`);}- assert.match(policy, /`https:\/\/api\.deepseek\.com\/\*`/);+ for (const origin of manifest.host_permissions) {+ assert.ok(policy.includes(`\`${origin}\``), `policy must disclose ${origin}`);+ }assert.match(policy, /`<all_urls>`/);});+test("privacy policy states the Chrome Web Store Limited Use boundary", async () => {+ const policy = await privacyPolicy();+ assert.match(policy, /Chrome Web Store User Data Policy/);+ assert.match(policy, /Limited Use/);+ assert.match(policy, /不会将用户数据用于个性化广告/);+ assert.match(policy, /不会允许人工读取用户数据/);+});+test("privacy policy explains corrected article regions and safe download handling", async () => {const policy = await privacyPolicy();assert.match(policy, /添加遗漏内容、排除错误内容、整组修正、撤销或恢复自动识别/);diff --git a/test/release-identity.test.js b/test/release-identity.test.jsindex 969a0d2..0e7e209 100644--- a/test/release-identity.test.js+++ b/test/release-identity.test.js@@ -2,7 +2,9 @@ import test from "node:test";import assert from "node:assert/strict";import {+ chromeStoreUploadManifest,extensionArchiveName,+ extensionIdFromPublicKey,hasStableExtensionIdentity,requireStableExtensionIdentity} from "../tools/release-identity.mjs";@@ -19,5 +21,15 @@ test("development packages are visibly marked until the Web Store public key exitest("release packages keep the normal name only with a stable manifest public key", () => {const manifest = { version: "1.14.0", key: examplePublicKey };assert.equal(hasStableExtensionIdentity(manifest), true);+ assert.equal(extensionArchiveName(manifest), "PromptDirector-1.14.0-FIXED-ID-DEV.zip");assert.equal(extensionArchiveName(manifest, { release: true }), "PromptDirector-1.14.0.zip");+ assert.match(extensionIdFromPublicKey(manifest), /^[a-p]{32}$/);+});++test("Chrome Web Store upload manifests omit the development identity key", () => {+ const manifest = { manifest_version: 3, version: "1.14.0", key: examplePublicKey };+ const uploadManifest = chromeStoreUploadManifest(manifest);+ assert.equal(uploadManifest.key, undefined);+ assert.equal(uploadManifest.version, manifest.version);+ assert.equal(manifest.key, examplePublicKey);});diff --git a/test/sharing_and_data_safety_e2e.py b/test/sharing_and_data_safety_e2e.pyindex be10934..972dc8e 100644--- a/test/sharing_and_data_safety_e2e.py+++ b/test/sharing_and_data_safety_e2e.py@@ -53,6 +53,12 @@ def main() -> None:await saveMediaBlob('share-document', new Blob(['%PDF-1.4 fixture'], {type: 'application/pdf'}), {checkCapacity: false});}""")+ setup.wait_for_function(+ """async () => {+ const state = await chrome.runtime.sendMessage({type: 'GET_STATE'});+ return state?.entries?.length === 2;+ }"""+ )library = session.open_page("library.html", wait_until="networkidle")library.locator("#search-input").fill("share-")library.locator("#select-cases").click()diff --git a/tools/build-store-assets.mjs b/tools/build-store-assets.mjsnew file mode 100644index 0000000..a056314--- /dev/null+++ b/tools/build-store-assets.mjs@@ -0,0 +1,31 @@+import { readFile, writeFile } from "node:fs/promises";+import { join } from "node:path";+import { fileURLToPath } from "node:url";+import { Resvg } from "@resvg/resvg-js";++const projectRoot = fileURLToPath(new URL("../", import.meta.url));+const checkOnly = process.argv.includes("--check");+const iconSource = await readFile(join(projectRoot, "assets/icons/icon-source.svg"));+const promoSource = await readFile(join(projectRoot, "store/brand/prompt-director-promo-source.svg"));++const outputs = [+ ["store/brand/prompt-director-mark-source.png", render(iconSource, 1024)],+ ["store/small-promo-440x280.png", render(promoSource, 440)],+ ["store/brand/prompt-director-promo-source.png", render(promoSource, 1572)]+];++for (const [relativePath, bytes] of outputs) {+ const path = join(projectRoot, relativePath);+ if (checkOnly) {+ const current = await readFile(path).catch(() => null);+ if (!current?.equals(bytes)) throw new Error(`${relativePath} 不是当前品牌母版生成的商店素材`);+ } else {+ await writeFile(path, bytes);+ }+}++process.stdout.write(`${checkOnly ? "已核对" : "已生成"} ${outputs.length} 个商店品牌素材\n`);++function render(source, width) {+ return new Resvg(source, { fitTo: { mode: "width", value: width } }).render().asPng();+}diff --git a/tools/capture-store-screenshots.py b/tools/capture-store-screenshots.pynew file mode 100644index 0000000..353ffb0--- /dev/null+++ b/tools/capture-store-screenshots.py@@ -0,0 +1,159 @@+from __future__ import annotations++import sys+from pathlib import Path++from playwright.sync_api import expect+++PROJECT_ROOT = Path(__file__).resolve().parents[1]+sys.path.insert(0, str(PROJECT_ROOT / "test"))++from e2e_support import ai_configuration_fixture, base_entry, extension_session # noqa: E402+++OUTPUT_DIR = PROJECT_ROOT / "store" / "screenshots"+VIEWPORT = {"width": 1280, "height": 800}+DEMO_CASES = [+ ("电影感逆光人像", "用轮廓光分离人物与背景,保留克制的暗部层次。", [225, 63, 28]),+ ("低饱和庭院构图", "以门框建立前景,让主体停留在画面三分线附近。", [145, 30, 32]),+ ("冷调城市夜景", "用青蓝环境光统一空间,仅保留少量暖色视觉锚点。", [205, 42, 22]),+ ("高速动作镜头", "通过斜向动势、近景遮挡和速度差强化冲击。", [18, 67, 28]),+ ("产品静物光线", "用大面积柔光塑造材质,再以窄边光勾勒轮廓。", [48, 54, 36]),+ ("雾中山谷层次", "以前中后景的明度差建立空气透视和空间深度。", [168, 28, 38]),+ ("手绘角色表情", "先锁定眉眼和嘴角关系,再控制局部夸张程度。", [332, 43, 30]),+ ("留白海报版式", "让标题、主体和负空间形成清晰的阅读顺序。", [72, 70, 34]),+]+++def demo_entries() -> list[dict]:+ values: list[dict] = []+ for index, (title, prompt, _color) in enumerate(DEMO_CASES):+ entry = base_entry(+ f"store-demo-{index + 1}",+ f"演示 · {title}",+ prompt,+ "content:prompt:image",+ index,+ )+ asset_id = f"store-demo-image-{index + 1}"+ entry["mediaAssets"] = [{+ "id": asset_id,+ "kind": "image",+ "usage": "content",+ "storageMode": "managed",+ "mimeType": "image/png",+ "width": 960,+ "height": 720,+ "capturedAt": "2026-08-16T08:00:00.000Z",+ "reviewStatus": "verified",+ }]+ entry["primaryMediaId"] = asset_id+ entry["customLabels"] = ["商店演示素材"]+ values.append(entry)+ return values+++def main() -> None:+ entries = demo_entries()+ OUTPUT_DIR.mkdir(parents=True, exist_ok=True)+ with extension_session("prompt-director-store-assets-", viewport=VIEWPORT) as session:+ setup = session.open_page("collector.html", wait_until="networkidle")+ session.seed_storage(setup, {+ "schemaVersion": 24,+ "entries": entries,+ "dataSafetyOnboardingSeen": True,+ "organizerState": {+ "version": 6,+ "collections": [{+ "id": "collection:store-demo",+ "name": "视觉方向研究",+ "order": 0,+ "entryIds": [entry["id"] for entry in entries],+ }],+ },+ "uiPreferences": {"locale": "zh-CN", "theme": "dark", "motion": "none"},+ **ai_configuration_fixture(+ providers={+ "deepseek": {+ "endpoint": "https://api.deepseek.com/chat/completions",+ "protocol": "chat_completions",+ "apiKey": "store-screenshot-fixture-not-sent",+ "consent": True,+ "models": {"skillExtraction": "deepseek-v4-flash"},+ }+ },+ assignments={+ "skillExtraction": {"providerId": "deepseek", "model": "deepseek-v4-flash"}+ },+ ),+ })+ setup.evaluate(+ """async ({entries, colors}) => {+ const {saveMediaBlob} = await import(chrome.runtime.getURL('media-store.js'));+ for (const [index, entry] of entries.entries()) {+ const [hue, saturation, lightness] = colors[index];+ const canvas = document.createElement('canvas');+ canvas.width = 960;+ canvas.height = 720;+ const context = canvas.getContext('2d');+ const gradient = context.createLinearGradient(0, 0, canvas.width, canvas.height);+ gradient.addColorStop(0, `hsl(${hue} ${saturation}% ${Math.max(10, lightness - 14)}%)`);+ gradient.addColorStop(1, `hsl(${(hue + 54) % 360} ${Math.max(18, saturation - 18)}% ${Math.min(68, lightness + 18)}%)`);+ context.fillStyle = gradient;+ context.fillRect(0, 0, canvas.width, canvas.height);+ context.globalAlpha = .82;+ context.fillStyle = index % 2 ? '#d1fe17' : '#f4f5f0';+ context.beginPath();+ context.arc(260 + (index % 3) * 190, 250 + (index % 2) * 120, 155, 0, Math.PI * 2);+ context.fill();+ context.globalAlpha = .74;+ context.fillStyle = '#0f1113';+ context.fillRect(510 - (index % 2) * 140, 120, 245, 455);+ context.globalAlpha = 1;+ context.fillStyle = '#f4f5f0';+ context.font = '700 34px sans-serif';+ context.fillText(`STUDY ${String(index + 1).padStart(2, '0')}`, 42, 650);+ const blob = await new Promise((resolve) => canvas.toBlob(resolve, 'image/png'));+ await saveMediaBlob(entry.primaryMediaId, blob, {checkCapacity: false});+ }+ }""",+ {"entries": entries, "colors": [item[2] for item in DEMO_CASES]},+ )+ setup.wait_for_function(+ """async (count) => {+ const state = await chrome.runtime.sendMessage({type: 'GET_STATE'});+ return state?.entries?.length === count;+ }""",+ arg=len(entries),+ )++ library = session.open_page("library.html", wait_until="networkidle")+ expect(library.locator("#case-list .case-card")).to_have_count(len(entries))+ library.wait_for_function(+ """() => [...document.querySelectorAll('#case-list img')]+ .filter((image) => image.complete && image.naturalWidth > 0).length >= 6"""+ )+ library.screenshot(path=str(OUTPUT_DIR / "01-library-1280x800.png"), full_page=False)++ skills = session.open_page("skills.html", wait_until="networkidle")+ skills.locator("#skill-create").click()+ expect(skills.locator(".skill-case")).to_have_count(len(entries))+ skills.wait_for_function(+ """() => [...document.querySelectorAll('.skill-case-visual img')]+ .filter((image) => image.complete && image.naturalWidth > 0).length >= 6"""+ )+ skills.locator(".skill-case-toggle").nth(0).click()+ skills.locator(".skill-case-toggle").nth(2).click()+ skills.locator("#skill-goal").fill("提炼画面的主体层级、光线组织与色彩节奏")+ skills.screenshot(path=str(OUTPUT_DIR / "02-skills-1280x800.png"), full_page=False)++ composer = session.open_page("composer.html", wait_until="networkidle")+ expect(composer.locator("#composer-instruction")).to_be_visible()+ composer.screenshot(path=str(OUTPUT_DIR / "03-composer-1280x800.png"), full_page=False)++ print({"screenshots": [str(path) for path in sorted(OUTPUT_DIR.glob("0*-1280x800.png"))]})+++if __name__ == "__main__":+ main()diff --git a/tools/check-store-readiness.mjs b/tools/check-store-readiness.mjsnew file mode 100644index 0000000..206dab3--- /dev/null+++ b/tools/check-store-readiness.mjs@@ -0,0 +1,79 @@+import { readFile } from "node:fs/promises";+import { join } from "node:path";+import { fileURLToPath } from "node:url";++import { validateChromeStoreManifest } from "./chrome-store-manifest.mjs";+import { extensionIdFromPublicKey } from "./release-identity.mjs";++const projectRoot = fileURLToPath(new URL("../", import.meta.url));+const manifest = await json("manifest.json");+const locales = Object.fromEntries(await Promise.all(["zh_CN", "en"].map(async (locale) => [+ locale,+ await json(`_locales/${locale}/messages.json`)+])));+validateChromeStoreManifest({ manifest, locales });+const extensionId = extensionIdFromPublicKey(manifest);++const privacy = await text("store/PRIVACY_POLICY.md");+for (const permission of [...manifest.permissions, ...manifest.optional_permissions]) {+ requireText(privacy, `\`${permission}\``, `隐私政策缺少权限 ${permission}`);+}+for (const origin of [...manifest.host_permissions, ...manifest.optional_host_permissions]) {+ requireText(privacy, `\`${origin}\``, `隐私政策缺少域名权限 ${origin}`);+}+for (const phrase of ["Chrome Web Store User Data Policy", "Limited Use", "不会将用户数据用于个性化广告", "不会允许人工读取用户数据"]) {+ requireText(privacy, phrase, `隐私政策缺少 ${phrase}`);+}++const listingZh = await text("store/LISTING_ZH_CN.md");+const listingEn = await text("store/LISTING_EN.md");+const submission = await text("store/CHROME_WEB_STORE_SUBMISSION.md");+requireText(listingZh, locales.zh_CN.extensionName.message, "中文商店名称与 manifest 不一致");+requireText(listingEn, locales.en.extensionName.message, "英文商店名称与 manifest 不一致");+for (const permission of [+ ...manifest.permissions,+ ...manifest.optional_permissions,+ ...manifest.host_permissions,+ ...manifest.optional_host_permissions+]) {+ requireText(submission, `\`${permission}\``, `商店提交清单缺少 ${permission} 的说明`);+}+for (const phrase of ["Remote code", "Limited Use", "npm run package:release", extensionId]) {+ requireText(submission, phrase, `商店提交清单缺少 ${phrase}`);+}++for (const [path, expectedWidth, expectedHeight] of [+ ["assets/icons/icon-128.png", 128, 128],+ ["store/small-promo-440x280.png", 440, 280],+ ["store/screenshots/01-library-1280x800.png", 1280, 800],+ ["store/screenshots/02-skills-1280x800.png", 1280, 800],+ ["store/screenshots/03-composer-1280x800.png", 1280, 800]+]) {+ const bytes = await readFile(join(projectRoot, path)).catch(() => null);+ if (!bytes) throw new Error(`商店素材缺少 ${path}`);+ const dimensions = pngDimensions(bytes);+ if (dimensions.width !== expectedWidth || dimensions.height !== expectedHeight) {+ throw new Error(`${path} 尺寸应为 ${expectedWidth}x${expectedHeight},当前为 ${dimensions.width}x${dimensions.height}`);+ }+}++process.stdout.write("Chrome Web Store 本地提交材料检查通过\n");++async function json(path) {+ return JSON.parse(await text(path));+}++async function text(path) {+ return readFile(join(projectRoot, path), "utf8");+}++function requireText(source, value, message) {+ if (!source.includes(value)) throw new Error(message);+}++function pngDimensions(bytes) {+ if (bytes.length < 24 || bytes.subarray(1, 4).toString("ascii") !== "PNG") {+ throw new Error("商店素材必须是真实 PNG 文件");+ }+ return { width: bytes.readUInt32BE(16), height: bytes.readUInt32BE(20) };+}diff --git a/tools/chrome-store-manifest.mjs b/tools/chrome-store-manifest.mjsnew file mode 100644index 0000000..105eeb4--- /dev/null+++ b/tools/chrome-store-manifest.mjs@@ -0,0 +1,29 @@+const LOCALIZED_MESSAGE = /^__MSG_([A-Za-z0-9_]+)__$/;++export function validateChromeStoreManifest({ manifest = {}, locales = {} } = {}) {+ if (manifest.manifest_version !== 3) throw new Error("Chrome Web Store 只接受当前项目的 Manifest V3 包");+ if (!/^\d+(?:\.\d+){0,3}$/.test(String(manifest.version ?? ""))) {+ throw new Error("Chrome 扩展 version 必须由一到四段非负整数组成");+ }+ const fields = [+ ["name", 75],+ ["description", 132],+ ...(manifest.short_name === undefined ? [] : [["short_name", 12]])+ ];+ for (const [field, limit] of fields) {+ const key = localizedKey(manifest[field], field);+ for (const [locale, messages] of Object.entries(locales)) {+ const value = String(messages?.[key]?.message ?? "");+ if (!value) throw new Error(`${locale} 缺少 manifest ${field} 对应的 ${key}`);+ if ([...value].length > limit) {+ throw new Error(`${locale} 的 manifest ${field} 超过 Chrome 上限 ${limit} 个字符`);+ }+ }+ }+}++function localizedKey(value, field) {+ const match = LOCALIZED_MESSAGE.exec(String(value ?? ""));+ if (!match) throw new Error(`manifest ${field} 必须使用本地化消息`);+ return match[1];+}diff --git a/tools/package-extension.mjs b/tools/package-extension.mjsindex dd78792..a6f897c 100644--- a/tools/package-extension.mjs+++ b/tools/package-extension.mjs@@ -2,18 +2,23 @@ import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";import { basename, extname, join, relative } from "node:path";import { fileURLToPath } from "node:url";import { createZipBlob } from "../zip.js";+import { validateChromeStoreManifest } from "./chrome-store-manifest.mjs";import { verifyPdfjsRuntime } from "./pdfjs-runtime.mjs";-import { extensionArchiveName } from "./release-identity.mjs";+import { chromeStoreUploadManifest, extensionArchiveName } from "./release-identity.mjs";const projectRoot = fileURLToPath(new URL("../", import.meta.url));-const manifest = JSON.parse(await readFile(join(projectRoot, "manifest.json"), "utf8"));+const sourceManifest = JSON.parse(await readFile(join(projectRoot, "manifest.json"), "utf8"));+const release = process.argv.includes("--release");+const manifest = release ? chromeStoreUploadManifest(sourceManifest) : sourceManifest;const runtimeExtensions = new Set([".css", ".html", ".js"]);const files = [];await verifyPdfjsRuntime({ projectRoot });for (const name of await readdir(projectRoot)) {- if (name === "manifest.json" || runtimeExtensions.has(extname(name))) {+ if (name === "manifest.json") {+ files.push({ name, data: Buffer.from(`${JSON.stringify(manifest, null, 2)}\n`) });+ } else if (runtimeExtensions.has(extname(name))) {files.push(await packageFile(join(projectRoot, name)));}}@@ -44,11 +49,17 @@ for (const locale of await readdir(join(projectRoot, "_locales"), { withFileType}}+const locales = Object.fromEntries(await Promise.all((await readdir(join(projectRoot, "_locales"), { withFileTypes: true }))+ .filter((locale) => locale.isDirectory())+ .map(async (locale) => [+ locale.name,+ JSON.parse(await readFile(join(projectRoot, "_locales", locale.name, "messages.json"), "utf8"))+ ])));+validateChromeStoreManifest({ manifest, locales });validateManifest(manifest, files.map((file) => file.name));await mkdir(join(projectRoot, "dist"), { recursive: true });const archive = await createZipBlob(files);-const release = process.argv.includes("--release");-const outputPath = join(projectRoot, "dist", extensionArchiveName(manifest, { release }));+const outputPath = join(projectRoot, "dist", extensionArchiveName(sourceManifest, { release }));await writeFile(outputPath, new Uint8Array(await archive.arrayBuffer()));process.stdout.write(`${outputPath}\n${files.length} 个运行文件,${archive.size} 字节\n`);@@ -71,7 +82,7 @@ async function runtimeFiles(directory) {function validateManifest(value, paths) {if (value.manifest_version !== 3) throw new Error("只允许打包 Manifest V3 扩展");- if (!/^\d+\.\d+\.\d+$/.test(value.version ?? "")) throw new Error("manifest 版本号无效");+ if (!/^\d+(?:\.\d+){0,3}$/.test(value.version ?? "")) throw new Error("manifest 版本号无效");if (!/^__MSG_[A-Za-z0-9_]+__$/.test(String(value.name ?? ""))) throw new Error("manifest 品牌名未使用本地化消息");for (const required of ["manifest.json", "LICENSE", "NOTICE", "THIRD_PARTY_NOTICES.md", "ui-foundation.css", "ui-icons.js", "assets/ui-icons.svg", "collector.html", "collector.js", "collector-view.js", "collector.css", "capture-draft.js", "compound-cases.js", "media.js", "media-store.js", "visuals.js", "composer.html", "composer-page.js", "composer-page.css", "composer-diagnostics.js", "creative-skills.js", "creative-skill-package.js", "creative-skill-service.js", "skill-contact-sheet.js", "skills.html", "skills-page.js", "skills-page.css", "curated.html", "curated-page.js", "curated.css", "curated-catalog.js", "curated-import.js", "curated-config.js", "background.js", "image-transaction.js", "assets/icons/icon-128.png", "_locales/zh_CN/messages.json", "_locales/en/messages.json"]) {if (!paths.includes(required)) throw new Error(`发布包缺少 ${required}`);diff --git a/tools/release-identity.mjs b/tools/release-identity.mjsindex 1f87a49..bb7b1e2 100644--- a/tools/release-identity.mjs+++ b/tools/release-identity.mjs@@ -1,3 +1,5 @@+import { createHash } from "node:crypto";+export function hasStableExtensionIdentity(manifest = {}) {const key = String(manifest.key ?? "").replace(/\s+/g, "");if (!/^[A-Za-z0-9+/]+={0,2}$/.test(key) || key.length < 128) return false;@@ -17,9 +19,24 @@ export function requireStableExtensionIdentity(manifest = {}) {}}+export function extensionIdFromPublicKey(manifest = {}) {+ requireStableExtensionIdentity(manifest);+ const digest = createHash("sha256").update(Buffer.from(String(manifest.key).replace(/\s+/g, ""), "base64")).digest("hex").slice(0, 32);+ return [...digest].map((character) => String.fromCharCode(97 + Number.parseInt(character, 16))).join("");+}++export function chromeStoreUploadManifest(manifest = {}) {+ requireStableExtensionIdentity(manifest);+ const { key: _developmentIdentityKey, ...uploadManifest } = manifest;+ return uploadManifest;+}+export function extensionArchiveName(manifest = {}, { release = false } = {}) {const version = String(manifest.version ?? "").trim();- if (release) requireStableExtensionIdentity(manifest);- const suffix = hasStableExtensionIdentity(manifest) ? "" : "-UNFIXED-ID-DEV";+ if (release) {+ requireStableExtensionIdentity(manifest);+ return `PromptDirector-${version}.zip`;+ }+ const suffix = hasStableExtensionIdentity(manifest) ? "-FIXED-ID-DEV" : "-UNFIXED-ID-DEV";return `PromptDirector-${version}${suffix}.zip`;}