-
Notifications
You must be signed in to change notification settings - Fork 5.7k
feat(SUD-1512): add ocho.i18n-parity plugin — full multi-locale scan + 5 worker tools #1915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
achtung-ocho
wants to merge
1
commit into
paperclipai:master
Choose a base branch
from
achtung-ocho:feat/SUD-1512-i18n-parity-plugin
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,447
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "name": "@ocho/plugin-i18n-parity", | ||
| "version": "0.1.0", | ||
| "type": "module", | ||
| "exports": { | ||
| ".": "./src/index.ts" | ||
| }, | ||
| "paperclipPlugin": { | ||
| "manifest": "./dist/manifest.js", | ||
| "worker": "./dist/worker.js", | ||
| "ui": "./dist/ui" | ||
| }, | ||
| "scripts": { | ||
| "prebuild": "node ../../../../scripts/ensure-plugin-build-deps.mjs", | ||
| "build": "tsc && node ./scripts/build-ui.mjs", | ||
| "clean": "rm -rf dist", | ||
| "typecheck": "pnpm --filter @paperclipai/plugin-sdk build && tsc --noEmit" | ||
| }, | ||
| "dependencies": { | ||
| "@paperclipai/plugin-sdk": "workspace:*", | ||
| "cheerio": "^1.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/node": "^24.6.0", | ||
| "@types/react": "^19.2.2", | ||
| "@types/react-dom": "^19.2.2", | ||
| "esbuild": "^0.25.11", | ||
| "react": "^19.2.0", | ||
| "react-dom": "^19.2.0", | ||
| "typescript": "^5.7.3" | ||
| } | ||
| } |
24 changes: 24 additions & 0 deletions
24
packages/plugins/examples/plugin-i18n-parity/scripts/build-ui.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import esbuild from "esbuild"; | ||
| import path from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
|
|
||
| const __filename = fileURLToPath(import.meta.url); | ||
| const __dirname = path.dirname(__filename); | ||
| const packageRoot = path.resolve(__dirname, ".."); | ||
|
|
||
| await esbuild.build({ | ||
| entryPoints: [path.join(packageRoot, "src/ui/index.tsx")], | ||
| outfile: path.join(packageRoot, "dist/ui/index.js"), | ||
| bundle: true, | ||
| format: "esm", | ||
| platform: "browser", | ||
| target: ["es2022"], | ||
| sourcemap: true, | ||
| external: [ | ||
| "react", | ||
| "react-dom", | ||
| "react/jsx-runtime", | ||
| "@paperclipai/plugin-sdk/ui", | ||
| ], | ||
| logLevel: "info", | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export { default as manifest } from "./manifest.js"; | ||
| export { default as worker } from "./worker.js"; |
163 changes: 163 additions & 0 deletions
163
packages/plugins/examples/plugin-i18n-parity/src/manifest.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,163 @@ | ||
| import type { PaperclipPluginManifestV1 } from "@paperclipai/plugin-sdk"; | ||
|
|
||
| const manifest: PaperclipPluginManifestV1 = { | ||
| id: "ocho.i18n-parity", | ||
| apiVersion: 1, | ||
| version: "0.1.0", | ||
| displayName: "i18n Parity Scanner", | ||
| description: | ||
| "Scans localized HTML pages and scores translation parity per surface. Surfaces still-English content across all supported locales.", | ||
| author: "Ocho", | ||
| categories: ["automation", "connector"], | ||
| capabilities: [ | ||
| "agent.tools.register", | ||
| "activity.log.write", | ||
| "ui.sidebar.register", | ||
| "ui.page.register", | ||
| "ui.dashboardWidget.register", | ||
| "companies.read", | ||
| "issues.create", | ||
| ], | ||
| entrypoints: { | ||
| worker: "./dist/worker.js", | ||
| ui: "./dist/ui", | ||
| }, | ||
| instanceConfigSchema: { | ||
| type: "object", | ||
| properties: { | ||
| repoPath: { | ||
| type: "string", | ||
| description: | ||
| "Absolute path to the sudokuaday.com repo root to scan.", | ||
| }, | ||
| localeConfigFile: { | ||
| type: "string", | ||
| description: | ||
| "Path to the locale config JSON file, relative to repoPath. Defaults to 'config.locales.json'.", | ||
| }, | ||
| minScore: { | ||
| type: "number", | ||
| description: | ||
| "Minimum weighted parity score (0–1) below which a page is flagged. Defaults to 0.7.", | ||
| }, | ||
| surfaceWeights: { | ||
| type: "object", | ||
| description: | ||
| "Map of surface name to weight multiplier. Surfaces: meta, nav, hero, main, cta, footer, embeds.", | ||
| additionalProperties: { type: "number" }, | ||
| }, | ||
| excludePatterns: { | ||
| type: "array", | ||
| items: { type: "string" }, | ||
| description: | ||
| "Glob patterns (relative to repoPath) to exclude from scanning.", | ||
| }, | ||
| }, | ||
| required: ["repoPath"], | ||
| }, | ||
| tools: [ | ||
| { | ||
| name: "run-scan", | ||
| displayName: "Run i18n Parity Scan", | ||
| description: | ||
| "Scans all localized HTML pages and returns parity scores. Accepts optional locale filter and page limit.", | ||
| parametersSchema: { | ||
| type: "object", | ||
| properties: { | ||
| locale: { | ||
| type: "string", | ||
| description: | ||
| "Locale code to scan (e.g. 'ja'). Omit to scan all non-English locales.", | ||
| }, | ||
| pageLimit: { | ||
| type: "number", | ||
| description: "Maximum number of pages to scan per locale.", | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| name: "get-report", | ||
| displayName: "Get Parity Report", | ||
| description: | ||
| "Returns the full parity report (all locales, all pages) from the most recent scan.", | ||
| parametersSchema: { | ||
| type: "object", | ||
| properties: {}, | ||
| }, | ||
| }, | ||
| { | ||
| name: "get-summary", | ||
| displayName: "Get Parity Summary", | ||
| description: | ||
| "Returns a per-locale aggregate summary from the most recent scan, sorted by score ascending.", | ||
| parametersSchema: { | ||
| type: "object", | ||
| properties: {}, | ||
| }, | ||
| }, | ||
| { | ||
| name: "get-page-detail", | ||
| displayName: "Get Page Parity Detail", | ||
| description: | ||
| "Returns per-surface detail for a specific locale+path combination.", | ||
| parametersSchema: { | ||
| type: "object", | ||
| properties: { | ||
| locale: { type: "string", description: "Locale code, e.g. 'ja'." }, | ||
| path: { | ||
| type: "string", | ||
| description: "Page path relative to locale root, e.g. 'index.html'.", | ||
| }, | ||
| }, | ||
| required: ["locale", "path"], | ||
| }, | ||
| }, | ||
| { | ||
| name: "create-tickets", | ||
| displayName: "Create Parity Tickets", | ||
| description: | ||
| "Creates Paperclip issues for pages that fall below the minScore threshold from the most recent scan.", | ||
| parametersSchema: { | ||
| type: "object", | ||
| properties: { | ||
| minScore: { | ||
| type: "number", | ||
| description: | ||
| "Override threshold (0–1). Defaults to plugin config minScore.", | ||
| }, | ||
| dryRun: { | ||
| type: "boolean", | ||
| description: | ||
| "If true, returns planned ticket list without creating issues.", | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| ], | ||
| ui: { | ||
| slots: [ | ||
| { | ||
| type: "sidebar", | ||
| id: "i18n-parity-sidebar", | ||
| displayName: "i18n Parity", | ||
| exportName: "I18nParitySidebar", | ||
| }, | ||
| { | ||
| type: "page", | ||
| id: "i18n-parity-page", | ||
| displayName: "i18n Parity Report", | ||
| routePath: "i18n-parity", | ||
| exportName: "I18nParityPage", | ||
| }, | ||
| { | ||
| type: "dashboardWidget", | ||
| id: "i18n-parity-widget", | ||
| displayName: "i18n Parity Snapshot", | ||
| exportName: "I18nParityWidget", | ||
| }, | ||
| ], | ||
| }, | ||
| }; | ||
|
|
||
| export default manifest; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maxTicketsparameter missing fromcreate-ticketsmanifest schemaThe worker's
create-ticketshandler reads and appliesinput.maxTickets(worker.ts lines 694–703), but this parameter is not declared in the manifest'sparametersSchema. AI model consumers won't know it's a valid input, and Paperclip's parameter validation may reject or ignore it silently.Prompt To Fix With AI