feat: complete TypeScript + modern React rewrite of plugin-prophet#132
Draft
KagamiChan with Copilot wants to merge 4 commits into
Draft
feat: complete TypeScript + modern React rewrite of plugin-prophet#132KagamiChan with Copilot wants to merge 4 commits into
KagamiChan with Copilot wants to merge 4 commits into
Conversation
Copilot
AI
changed the title
[WIP] Complete rewrite plan for Poi plugin repo
feat: complete TypeScript + modern React rewrite of plugin-prophet
Jul 5, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Replaces the entire legacy
.esJavaScript / React class component stack with TypeScript strict mode, modern React function components, andtsdownCJS build — following the implementation plan indocs/typescript-react-rewrite-plan.md.Infrastructure
tsconfig.jsonwith strict mode, project references tolib/battle(forces compiled.d.tsover.tssources),baseUrl: ".",ES2019targettsdown.config.ts: CJS output at repo rootindex.js/index.d.ts,lib/battlebundled inline, all Poi host modules (react,redux,lodash,views/*, etc.) externalizedvitest.config.tswith jsdom + Poi module mock aliaseseslint.config.ts) replacing old.eslintrc.js; requiresjitifor TS config loadingHost adapters (
src/host/)Thin wrappers over Poi globals and
views/*host modules with typed interfaces. Stub.d.tsfiles for allviews/*path aliases. Hand-rolledredux-observers.d.tsshim (no@typespackage exists).State layer (
src/state/)Redux reducer (
plugin-reducer.ts) handlinghistory/useitemwith debounced localStorage persistence viastorage.ts. Reselect-based selectors. Redux observers for cache sync.Battle domain (
src/battle/)lib-battle-adapter.ts: single import boundary for all lib-battle v3 symbols (note:Shipexported as value, not type;ShipOwneris a string enum;Fleet/Battleconstructors rejectnullforsupport/time)packet-controller.ts: pure dependency-injected class; handles allgame.responsepaths, tracksmvpPos: [number, number](lib-battle v3 droppedship.isMvp)view-model-builder.ts: convertsBattleStateSnapshot→ProphetViewModelComponents (
src/components/)All legacy
src/views/**/*.esreplaced:hp-bar,ship-card,ship-tooltip,fleet-column,battle-panel,battle-summary,drop-info,next-spot-info,land-base-squad, settings components.Plugin root (
src/plugin/,src/index.ts)ProphetRoot/SettingsRootpreserve the Poi plugin contract (reactClass,settingsClass,reducer,switchPluginPath).connect+withTranslationchained explicitly (avoidscomposedeep type instantiation issue).Tests (
test/)51 unit tests covering actions, reducer, storage (with fake timers), layout, spot, and transport point calculation.
Cleanup
All
src/**/*.es,index.es,.eslintrc.js,.eslintignoreremoved. Build artifacts (index.js,index.d.ts) added to.gitignore.Note
.github/workflows/test.ymlneeds manual update (Node 14→22, addlib/battlebuild step, addtypecheck/test/buildCI steps) — the App lacksworkflowspermission to push that file.Original prompt
complete the whole rewrite plan
[Chronological Review: User asked whether to migrate old Poi plugin repo to TypeScript + modern React or rewrite. Repo inspection found old `.es` JavaScript, large class component `src/index.es`, connected UI stack, old JS `lib/battle` submodule, lint-only CI. Recommendation evolved from incremental migration to rewriting UI/app layer while preserving plugin contract and domain parity, especially after user noted new `lib-battle` is now TypeScript. User requested an implementation-ready rewrite plan under `docs/`; a detailed plan was created, repeatedly rubber-ducked/adversarially reviewed, updated to use `tsdown`, hardened for parity/CI/package/lib-battle/legacy interop, then committed to a PR. Final user noted a comment about filename style and requested kebab-case; doc planned filenames were converted to kebab-case, committed, pushed, and CI passed.] [Intent Mapping: - Initial: “inspect this repo, I'm considering migrating to TypeScript + modern React… would you consider a complete rewrite with TypeScript instead?” - Concern: “this huge single component stack is too hard to maintain…” - Clarification: “so you lean towards rewrite now?” - Parity: “how would you keep the parity” - New constraint: “lib-battle is now completely in TS in its new version” - Deliverable: “create a rewrite doc under docs folder, make the plan implementation ready with full test coverage and quality/parity validation, the tech stack should be modern and don't leave randomness for coding agents” - Review process: “rubber duck the plan from multiple aspects”, then “you should have a subagent with isolated context to adversarily review it”, then “keep reviewing until converged” - Tooling correction: “wait in fact we'll use tsdown” - External review blockers: stale `lib-battle` pin and missing legacy↔TS interop bridge - PR request: “create a pr” - Review fix: “1 comment on the file name, please use kebab style” - Final current request: summarize without tools.] [Technical Inventory: Repo is `poooi/plugin-prophet`, Poi plugin. Current source uses `.es`, React class/components, decorators, Babel/stage-0 syntax (`do {}`, decorators), Redux, react-redux, redux-observers, reselect, lodash, styled-components, Blueprint, Poi host modules under `views/*`, globals `window`, `config`, `localStorage`, `window.ipc`, `window.ROOT`, `window.APPDATA_PATH`. Package currently had `main: "index.es"`, `prepack: poi-util-transpile --sm --replace`, old CI Node 14 + `actions/cache@v2`. New plan uses TypeScript strict, React function components/hooks, `tsdown`, Vitest, Testing Library, Playwright, ESLint flat config, Prettier, package smoke tests, `tsdown` CJS output root `index.js`/`index.d.ts` with `fixedExtension: false`, Node 22 CI, `actions/cache@v4`. New `lib-battle` target is upstream TypeScript rewrite `v3.0.5` unless newer tagged release recorded.] [Code Archaeology: - Inspected `package.json`, `.github/workflows/test.yml`, `.gitmodules`, `.eslintrc.js`, `src/index.es`, `src/redux.es`, `src/utils/lib-battle-adapter.es`, `src/views/battle-view-area.es`, `lib/battle/simulator.es`, settings/drop/ship/fleet files. - Key current pain files: `src/index.es` (~584 LOC) giant `ProphetBase` class handling host events, battle lifecycle, notifications, ResizeObserver, Redux selectors, rendering; `lib/battle/simulator.es` (~1353 LOC); `src/views/battle-view-area.es` connected view model + layout rendering; `src/redux.es` cache/reducer/observers; `src/utils/lib-battle-adapter.es` conversion/synthesis/translation. - Added new file `docs/typescript-react-rewrite-plan.md` (final about 890 lines). - Updated `.github/workflows/test.yml`: `actions/cache@v2` → `actions/cache@v4`. - Later modified `docs/typescript-react-rewrite-plan.md` to use kebab-case planned filenames: e.g. `lib-battle-adapter.ts`, `prophet-root.tsx`, `settings-root.tsx`, `plugin-exports.ts`, `poi-globals.ts`, `poi-redux.ts`, `poi-i18n.ts`, `poi-ui.tsx`, `poi-assets.ts`, `poi-types.ts`, `packet-controller.ts`, `battle-view-model.ts`, `damage-notification.ts`, `plugin-reducer.ts`, `battle-panel.tsx`, `fleet-column.tsx`, `ship-card.tsx`, `ship-tooltip.tsx`, `hp-bar.tsx`, `battle-summary.tsx`, `drop-info.tsx`, `next-spot-info.tsx`, `land-base-squad.tsx`, settings components, `kancolle-api.ts`, `view-models.ts`, `legacy-lib-battle-adapter.ts`.] [Progress Assessment: Completed: repo inspection; strategic recommendation; rewrite plan doc creation; multiple review rounds; switch from `tsup` to `tsdown`; hardening for build/package/CI/parity/fixtures/lib-battle/interop; PR creation; CI unblock; kebab-case filename update; CI green. Pending: no further code changes requested; PR #131 open and green; Copilot review only overview comment, no inline unresolved comments. Potential future: merge PR or address future review comments if any.] [Context Validation: Continuation needs: PR URL `https://github.com//pull/131`; branch `docs/typescript-r...Created from Copilot CLI via the copilot delegate command.