Skip to content

refactor(ui): extract shell copy resources - #4001

Closed
orangeCatDeveloper wants to merge 2 commits into
apache:mainfrom
orangeCatDeveloper:refactor/ui-chrome-copy-resources
Closed

refactor(ui): extract shell copy resources#4001
orangeCatDeveloper wants to merge 2 commits into
apache:mainfrom
orangeCatDeveloper:refactor/ui-chrome-copy-resources

Conversation

@orangeCatDeveloper

Copy link
Copy Markdown
Contributor

Part of #2672

Adding a shared UI locale still requires editing TypeScript presentation catalogs even when the visible copy and behavior do not change.

UiCatalog<T> guarantees locale coverage, but its exact resource-shape and named-placeholder checks were private to the CLI migration. Shared UI copy therefore remained coupled to executable formatter functions and had no package-level resource inventory.

This change promotes the reusable catalog definition and named-placeholder formatter to @maka/core, with the CLI retaining its existing aliases. packages/ui gains its own statically imported resource registry, and the shell-controls domain moves to locale-owned JSON while materializing the same public function API, including English singular/plural behavior. Tests discover every locale directory and verify registry coverage, nested shape, placeholders, compiled-resource presence, and rendered copy.

This is one domain-owned migration slice: it does not add a locale or change visible copy, layout, machine-readable output, or protocol behavior. Follow-up PRs will migrate the remaining domains incrementally.

Depends on #3990; this branch is based on that change and will be rebased after it lands.

Evidence

The before and after captures use the real Electron projectSidebarWindow fixture with the same Chinese locale and open search surface. The affected modal is byte-identical across the migration.

Before
$ git grep -l "Search task titles and content" HEAD^ -- packages/ui/src
packages/ui/src/shell-controls-copy.ts

After
$ find packages/ui/src/locales -name shell-controls.json | sort
packages/ui/src/locales/en/shell-controls.json
packages/ui/src/locales/zh/shell-controls.json
before_sha256=ad2304626abc432f84a99fbb324af1f10b2ffcb9590688cca625d2287c7b5adc
after_sha256=ad2304626abc432f84a99fbb324af1f10b2ffcb9590688cca625d2287c7b5adc
screenshots_identical=true

Verification

$ npm --workspace @maka/core test
ℹ tests 673
ℹ pass 673
ℹ fail 0

$ npm --workspace @maka/ui test
ℹ tests 233
ℹ pass 233
ℹ fail 0

$ npm --workspace maka-agent test
ℹ tests 546
ℹ pass 546
ℹ fail 0

$ npm --workspace @maka/desktop run e2e
1 skipped
70 passed

$ npm run typecheck

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex implemented and tested the refactor, reviewed the final diff, and prepared this PR description.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described above
  • No

Shared UI copy should use the same typed, domain-owned resource contract without duplicating catalog validation across packages.
@github-actions github-actions Bot added the effort/XL Over 1000 readable lines label Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XL Over 1000 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant