# Admin Reverse Workspace

This directory is the in-repo workspace for reversing `frontend/admin/assets/index-CO3BwsT2.js`
and related compiled admin assets into maintainable source-level structure.

## Current Status

- `output/`
  - Pretty-printed JS/CSS/locales generated from the compiled bundle.
- `extracted/router-manifest.js`
  - First-pass route tree extracted from the React Router config inside the bundle.
- `extracted/api-manifest.js`
  - First-pass admin API endpoint inventory extracted from the Axios wrapper section.
- `extracted/runtime-manifest.js`
  - First-pass shared runtime inventory for i18n, request client, auth, and error handling.
- `extracted/navigation-manifest.js`
  - First-pass sidebar/navigation href and i18n-key extraction.
- `scripts/inspect-bundle.cjs`
  - AST scan used to produce a structural report.
- `scripts/beautify-bundle.cjs`
  - Pretty-printer for the main bundle and locale files.

## What Was Still Incomplete Before Resuming

The interrupted run had only completed:

- Node/npm tooling bootstrap
- pretty-print output generation
- route manifest extraction

It had not yet completed:

- API manifest extraction
- reverse-workspace documentation
- source skeleton mapping from route/component ids back into `frontend/admin/src`

Those missing pieces are now partially completed by this workspace.

## Next Recommended Steps

1. Extract the sidebar/menu metadata from the bundle so route labels and navigation groups are preserved.
2. Map each lazy route factory symbol to a provisional source file in a reconstructed `src-reverse/`.
3. Extract shared request/auth/i18n/runtime modules from the bundle into readable modules first.
4. Rebuild page-by-page, starting from:
   - `user/manage`
   - `server/manage`
   - `finance/plan`
   - `user/ticket`
5. Only replace the current hand-written `frontend/admin/src` after the reconstructed source tree can render equivalently.

## Running The Tooling

Because the current shell session may not have Node in PATH, run with an explicit prefix if needed:

```powershell
$env:Path='C:\Program Files\nodejs;' + $env:Path
& 'C:\Program Files\nodejs\npm.cmd' run inspect
& 'C:\Program Files\nodejs\npm.cmd' run beautify
```
