Files
Reims-Go/internal/app/language_pack_test.go
NwflowerandClaude Opus 5.5 e259833b5f feat(plugins): rework the plugin market and first-run language packs
Market page
- Card grid that fills the width; cards show only icon, name,
  publisher (trust mark by color and icon), version and the action.
- Paints from cache via the new PeekPluginMarket binding, then revalidates;
  cards reveal 24 at a time as the feed scrolls.
- Category chips come from the index (MarketBrowseResult.kinds) instead of
  a fixed list; the alpha toggle and source badge are gone.
- Installed/Market is a segmented control; refresh now shows feedback.
- WordmarkLoader writes the Reims-Go wordmark stroke by stroke while the
  market loads (static pulse under reduced motion).

Install and enable
- reims:plugin-install events drive a progress bar on the card.
- After install, a dialog offers to enable the plugin and lists what it can
  do in plain words (PluginInfo.risks / MarketCatalogItem.risks, derived
  from tier, permissions and contributions in risks.go).
- Enabling a plugin that provides UI languages switches to the first one
  unless the current language is among them (PluginInfo.locales).

Trust
- A package installed from the project's own index, fetched over HTTPS in
  this session, inherits the index's trust level when its SHA-256 matches.
  Third-party indexes (REIMS_GO_PLUGIN_MARKET_URL) cannot vouch and show
  every entry as community.
- Trust no longer waives review: official packages get the same scan,
  high-risk approval and L3 hash check as any other; only builtin and
  bundled plugins are pre-approved.

First launch
- When the OS language is not covered by zh-CN/en-US, the folder screen
  looks up a matching pack once (SuggestLanguagePack) and offers to install
  it; Continue installs and enables it so the UI follows the OS language.
  Before setup the market keeps its index in memory only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 05:17:45 -07:00

40 lines
1.1 KiB
Go

package app
import (
"testing"
"github.com/Nwflower/reims-go/internal/config"
)
// Before first-run setup a.cfg only suggests a data folder: the market must
// not cache into it, nor keep a client bound to it past setup.
func TestPluginMarketBeforeSetupIsThrowaway(t *testing.T) {
a := &App{cfg: &config.Config{DataRoot: t.TempDir()}, needsSetup: true}
if a.getPluginMarket() == a.getPluginMarket() || a.pluginMarket != nil {
t.Fatal("market client was kept before setup")
}
a.needsSetup = false
if c := a.getPluginMarket(); c == nil || c != a.pluginMarket || c != a.getPluginMarket() {
t.Fatal("market client is not cached after setup")
}
}
func TestBuiltinCoversLocale(t *testing.T) {
for tag, want := range map[string]bool{
"": true,
"en-US": true,
"en-GB": true,
"zh-CN": true,
"zh-SG": true,
"zh-Hans": true,
"zh-TW": false, // Traditional script needs a pack
"zh-HK": false,
"ko-KR": false,
"ja-JP": false,
} {
if got := builtinCoversLocale(tag); got != want {
t.Errorf("builtinCoversLocale(%q) = %v, want %v", tag, got, want)
}
}
}