01

Packaging contract

MikuTV discovers repositories tagged mikutv-plugin and installs only plugin.zip from non-draft GitHub Releases. Unknown manifest fields fail decoding immediately.

RuleRequirement
topicmikutv-plugin (plus mikutv-theme or mikutv-locale)
assetRelease asset named plugin.zip, up to 8 MiB
tagMust match v<version> against plugin.json version
rootplugin.json at archive root, no wrapping directory, no symlinks
sha256Pinned by SHA-256 and repo ownership; updates cannot switch kind
02

Content sources

Source plugins declare kind: "source" with an ES module entry executed inside moejs. Every outbound host belongs in permissions.network; self-hosted servers may declare credentials and serverURL: "required" for single-origin LAN access.

{
  "id": "example-source",
  "name": "Example Source",
  "kind": "source",
  "version": "1.0.0",
  "apiVersion": 1,
  "minAppVersion": "0.1.0",
  "license": "Apache-2.0",
  "main": "index.js",
  "permissions": { "network": ["api.example.com"] },
  "capabilities": ["catalog.browse", "catalog.item", "playback.resolve"]
}
03

Sandbox host API

Inside moejs, plugins have standard ES syntax, allowlist-enforced fetch, and globalThis.host:

host.storage.get / set / deletePer-plugin persistent KV store, 8 KiB total quota
host.locale.current()Active normalized BCP-47 language tag (zh-Hans, en, ja)
host.crypto.sha256 / encryptRSAOAEPHex SHA-256 and RSA-OAEP-SHA256 helpers
host.compress.inflateZlib(bytes)Zlib inflate capped at 4 MiB output
04

Capabilities

Every declared capability requires its named export(s) in main. Missing exports fail package open.

CapabilityExportsRequires
catalog.browsebrowse—
catalog.itemgetItem—
catalog.searchsearch—
catalog.searchSuggestsearchSuggestcatalog.search
catalog.seriesreadSeries—
catalog.livereadLive—
catalog.creatorreadCreator—
catalog.videoCommentsvideoComments—
catalog.followingreadFollowingaccount.signIn
catalog.libraryreadAccountaccount.signIn
playback.resolveresolvePlayback—
playback.progressreportPlaybackaccount.signIn
playback.danmakureadDanmaku—
playback.subtitlesreadSubtitles—
live.chatconnectLiveChat—
live.chatWritesendLiveChatlive.chat + account.signIn
account.signInrestoreAccount, signOut, beginSignIn/pollSignIn or signInWithCredentialsauthentication.methods
account.videoInteractioneditVideoaccount.signIn
account.videoFavoritesvideoFavoriteFolders, editVideoFavoriteFoldersaccount.signIn
account.danmakupostDanmakuaccount.signIn
account.danmakuRulesreadDanmakuRules, addDanmakuRule, removeDanmakuRuleaccount.signIn
account.followCreatorfollowCreatoraccount.signIn
account.trackSeriestrackSeries—
account.history / watchLater / favorites / tracking / courses / notificationsreadAccountaccount.signIn
account.editFavoriteFolderseditFavoriteFolderaccount.favorites
account.editHistory / editWatchLater / editTrackingremoveAccountItemsmatching read capability
account.privateMessagesreadPrivateConversations, readPrivateMessagesaccount.signIn
account.writePrivateMessagessendPrivateMessage, markPrivateMessagesReadaccount.privateMessages
05

Themes

Themes run no JavaScript — only plugin.json and theme.json (≤ 64 KiB) overriding 46 semantic tokens. Contrast ratios (4.5:1 text, 3.0:1 focus ring) are checked on open.

theme.json
{
  "schemaVersion": 1,
  "base": "mikutv-dark",
  "appearance": "dark",
  "colors": {
    "surface": {
      "canvas": "#16161E",
      "sidebar": "#13131A",
      "panel": "#1A1B26"
    },
    "accent": {
      "primary": "#7AA2F7",
      "soft": "#89B4FA"
    }
  }
}
06

Language packs

Language packs are pure JSON (locale.json ≤ 256 KiB) mirroring internal/ui/assets/labels.en.json; omitted keys fall back to English. Reference: yuchanns/mikutv-locale-ja.

{
  "id": "mikutv-locale-ja",
  "name": "Japanese (日本語)",
  "kind": "locale",
  "version": "1.0.0",
  "apiVersion": 1,
  "minAppVersion": "0.1.0",
  "license": "Apache-2.0",
  "language": "ja",
  "nativeName": "日本語",
  "locale": "locale.json"
}
07

Verify & publish

PACKAGE & VERIFY
zip -r -X plugin.zip plugin.json LICENSE index.js
# Validate via internal/plugin:
#   InspectPackage / Open / OpenTheme / OpenLocale
# Tag v1.0.0 -> GitHub Release -> attach plugin.zip
# Add repository topic: mikutv-plugin
MikuTV plugin discovery screen on Apple TV 4K
ONCE PUBLISHED WITH A RELEASE AND TOPIC:MIKUTV-PLUGIN, IT APPEARS IN APPLE TV DISCOVERY.