@metricinsights/pp-dev 0.19.0 → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +148 -0
  2. package/README.md +222 -250
  3. package/dist/CHANGELOG.md +148 -0
  4. package/dist/README.md +222 -250
  5. package/dist/cjs/cli.js +1 -1
  6. package/dist/cjs/cli.js.map +1 -1
  7. package/dist/cjs/helpers.js +1 -1
  8. package/dist/cjs/helpers.js.map +1 -1
  9. package/dist/cjs/index-MzGAxNTB.js +2 -0
  10. package/dist/cjs/index-MzGAxNTB.js.map +1 -0
  11. package/dist/cjs/index.js +1 -1
  12. package/dist/cjs/migrate-r2mXdGLZ.js +2 -0
  13. package/dist/cjs/migrate-r2mXdGLZ.js.map +1 -0
  14. package/dist/cjs/package.json +16 -16
  15. package/dist/cjs/plugin-34c8_AjI.js +2 -0
  16. package/dist/cjs/plugin-34c8_AjI.js.map +1 -0
  17. package/dist/cjs/plugin.js +1 -1
  18. package/dist/cjs/version-plugin-BOFuJ-Rp.js +2 -0
  19. package/dist/cjs/{version-plugin-DUKsGBsW.js.map → version-plugin-BOFuJ-Rp.js.map} +1 -1
  20. package/dist/client/client.css +1 -1
  21. package/dist/client/client.css.map +1 -1
  22. package/dist/client/client.js +30 -19
  23. package/dist/client/client.js.map +1 -1
  24. package/dist/client/index.html +33 -16
  25. package/dist/esm/cli.js +1 -1
  26. package/dist/esm/cli.js.map +1 -1
  27. package/dist/esm/helpers.js +1 -1
  28. package/dist/esm/helpers.js.map +1 -1
  29. package/dist/esm/index-C7dYPskY.js +2 -0
  30. package/dist/esm/index-C7dYPskY.js.map +1 -0
  31. package/dist/esm/index.js +1 -1
  32. package/dist/esm/migrate-BYuCtRbI.js +2 -0
  33. package/dist/esm/migrate-BYuCtRbI.js.map +1 -0
  34. package/dist/esm/package.json +16 -16
  35. package/dist/esm/plugin-Dvva-sxE.js +2 -0
  36. package/dist/esm/plugin-Dvva-sxE.js.map +1 -0
  37. package/dist/esm/plugin.js +1 -1
  38. package/dist/esm/version-plugin-vu8VWkws.js +2 -0
  39. package/dist/esm/{version-plugin-C7j2jDQX.js.map → version-plugin-vu8VWkws.js.map} +1 -1
  40. package/dist/types/index.d.ts +103 -139
  41. package/package.json +34 -28
  42. package/dist/cjs/index-Bb3yIW5d.js +0 -2
  43. package/dist/cjs/index-Bb3yIW5d.js.map +0 -1
  44. package/dist/cjs/plugin-CqahMAGe.js +0 -2
  45. package/dist/cjs/plugin-CqahMAGe.js.map +0 -1
  46. package/dist/cjs/version-plugin-DUKsGBsW.js +0 -2
  47. package/dist/esm/index-Cd-DmbPQ.js +0 -2
  48. package/dist/esm/index-Cd-DmbPQ.js.map +0 -1
  49. package/dist/esm/plugin-BeehFkJq.js +0 -2
  50. package/dist/esm/plugin-BeehFkJq.js.map +0 -1
  51. package/dist/esm/version-plugin-C7j2jDQX.js +0 -2
package/dist/README.md CHANGED
@@ -45,142 +45,79 @@ import ppDev from '@metricinsights/pp-dev';
45
45
  // Plugin only (for Vite integration)
46
46
  import { vitePPDev } from '@metricinsights/pp-dev/plugin';
47
47
 
48
- // Helpers only (for utility functions)
49
- import { helpers } from '@metricinsights/pp-dev/helpers';
48
+ // Helpers only (defineConfig and utility functions)
49
+ import { defineConfig } from '@metricinsights/pp-dev/helpers';
50
50
 
51
51
  // Client assets (for development UI)
52
52
  import '@metricinsights/pp-dev/client/css/client.css';
53
53
  ```
54
54
 
55
- **Available Exports**:
56
-
57
- - **Main**: Complete pp-dev functionality with CLI and plugins
58
- - **Plugin**: Vite plugin for integration with build tools
59
- - **Helpers**: Utility functions for authentication and configuration
60
- - **Client**: Development UI assets and styles
61
-
62
- ## 🚀 Performance & Build System
63
-
64
- The pp-dev package includes optimized startup performance and build system with multiple strategies:
65
-
66
- ### Quick Start
67
-
68
- ```bash
69
- # Standard build (parallel)
70
- npm run build
71
-
72
- # Fast development build
73
- npm run build:fast
74
-
75
- # Watch mode for development
76
- npm run build:watch
77
-
78
- # Bundle analysis
79
- npm run build:analyze
80
-
81
- # Performance profiling
82
- npm run startup:profile
83
-
84
- # Startup optimization
85
- npm run startup:optimize
86
- ```
87
-
88
- ### Performance Features
89
-
90
- - **40-50% faster startup** with intelligent caching
91
- - **60-70% faster subsequent starts** with connection pooling
92
- - **Lazy loading** of heavy modules (jsdom, esbuild)
93
- - **API response caching** with configurable TTL
94
- - **HTTP connection pooling** for reduced overhead
95
- - **Startup profiling** with detailed performance analysis
96
- - **Intelligent dependency optimization** based on profiling data
97
-
98
- ### Build Features
99
-
100
- - **Parallel builds** for 40-60% faster build times
101
- - **Enhanced tree-shaking** for smaller bundles
102
- - **Multiple output formats** (ESM, CJS, Types)
103
- - **Bundle analysis** with visualizer support
104
- - **ESBuild integration** for faster TypeScript compilation
105
- - **Build optimization scripts** for performance tuning
106
-
107
- ### Startup Optimization
108
-
109
- The new startup optimization system in v0.11.0 provides:
110
-
111
- - **Performance Monitoring**: Real-time startup time tracking and analysis
112
- - **Cache Optimization**: Intelligent cache management for config and API responses
113
- - **Dependency Analysis**: Identification of performance bottlenecks
114
- - **Optimization Suggestions**: Automated recommendations for performance improvements
115
-
116
- Run the startup optimizer to analyze and improve your development environment:
117
-
118
- ```bash
119
- npm run startup:optimize
120
- ```
121
-
122
- 📖 See [BUILD_IMPROVEMENTS.md](./BUILD_IMPROVEMENTS.md) for build details.
123
- 📖 See [STARTUP_PERFORMANCE.md](./STARTUP_PERFORMANCE.md) for performance details.
124
-
125
55
  ## Configuration
126
56
 
127
57
  ### Configuration File
128
58
 
129
59
  Create a configuration file named `pp-dev.config` with one of these extensions:
130
60
 
61
+ - `.ts` (recommended)
131
62
  - `.js` or `.cjs` (for CommonJS)
132
- - `.ts` (for TypeScript)
133
63
  - `.json`
134
64
 
135
65
  Alternatively, you can define configuration in your `package.json` using the `pp-dev` key.
136
66
 
137
67
  ### Configuration Examples
138
68
 
139
- #### JavaScript (CommonJS)
140
-
141
- ```javascript
142
- // pp-dev.config.js
143
-
144
- /**
145
- * @type {import('@metricinsights/pp-dev').PPDevConfig}
146
- */
147
- module.exports = {
148
- backendBaseURL: 'https://mi.company.com',
149
- appId: 1,
150
- v7Features: true,
151
- miHudLess: true,
152
- integrateMiTopBar: true,
153
- };
154
- ```
155
-
156
- #### TypeScript
69
+ #### TypeScript (recommended)
157
70
 
158
71
  ```typescript
159
72
  // pp-dev.config.ts
73
+ import { defineConfig } from '@metricinsights/pp-dev';
74
+
75
+ export default defineConfig({
76
+ mi: {
77
+ url: 'https://mi.company.com',
78
+ token: process.env.MI_ACCESS_TOKEN,
79
+ mode: 'standalone',
80
+ apiVersion: 7,
81
+ },
82
+ app: {
83
+ id: 123,
84
+ type: 'template',
85
+ },
86
+ });
87
+ ```
160
88
 
161
- import { PPDevConfig } from '@metricinsights/pp-dev';
89
+ #### JavaScript (CommonJS)
162
90
 
163
- const config: PPDevConfig = {
164
- backendBaseURL: 'https://mi.company.com',
165
- appId: 1,
166
- v7Features: true,
167
- miHudLess: true,
168
- integrateMiTopBar: true,
169
- };
91
+ ```javascript
92
+ // pp-dev.config.js
93
+ const { defineConfig } = require('@metricinsights/pp-dev');
170
94
 
171
- export default config;
95
+ module.exports = defineConfig({
96
+ mi: {
97
+ url: 'https://mi.company.com',
98
+ mode: 'standalone',
99
+ apiVersion: 7,
100
+ },
101
+ app: {
102
+ id: 123,
103
+ type: 'template',
104
+ },
105
+ });
172
106
  ```
173
107
 
174
108
  #### JSON
175
109
 
176
110
  ```json
177
- // pp-dev.config.json
178
111
  {
179
- "backendBaseURL": "https://mi.company.com",
180
- "appId": 1,
181
- "v7Features": true,
182
- "miHudLess": true,
183
- "integrateMiTopBar": true
112
+ "mi": {
113
+ "url": "https://mi.company.com",
114
+ "mode": "standalone",
115
+ "apiVersion": 7
116
+ },
117
+ "app": {
118
+ "id": 123,
119
+ "type": "template"
120
+ }
184
121
  }
185
122
  ```
186
123
 
@@ -189,176 +126,138 @@ export default config;
189
126
  ```json
190
127
  {
191
128
  "name": "my-portal-page",
192
- "version": "1.0.0",
193
129
  "pp-dev": {
194
- "backendBaseURL": "https://mi.company.com",
195
- "appId": 1,
196
- "v7Features": true,
197
- "miHudLess": true,
198
- "integrateMiTopBar": true
130
+ "mi": {
131
+ "url": "https://mi.company.com",
132
+ "mode": "standalone"
133
+ },
134
+ "app": {
135
+ "id": 123
136
+ }
199
137
  }
200
138
  }
201
139
  ```
202
140
 
203
141
  ## Configuration Options
204
142
 
205
- > **Version Compatibility**: This documentation covers pp-dev v0.11.0+. Some options may not be available in older versions. Check the [CHANGELOG](./CHANGELOG.md) for version-specific information.
206
-
207
- ### Required Options
208
-
209
- | Option | Type | Description |
210
- | ---------------- | ------ | --------------------------------------------------------------------------- |
211
- | `backendBaseURL` | string | URL of the Metric Insights instance for API proxying |
212
- | `portalPageId` | number | ID of the Portal Page for variable values (deprecated, use `appId` instead) |
213
- | `appId` | number | ID of the Portal Page for variable values (synonym for `portalPageId`) |
143
+ ### `mi` — Metric Insights connection
214
144
 
215
- ### Optional Options
145
+ | Field | Type | Default | Description |
146
+ |--------------|-----------------------------------|----------------|-----------------------------------------------------------|
147
+ | `url` | `string` | — | URL of the Metric Insights instance |
148
+ | `token` | `string` | `MI_ACCESS_TOKEN` env | Personal access token for authentication |
149
+ | `mode` | `'standalone' \| 'embedding'` | `'standalone'` | Standalone hides the MI navigation; embedding keeps it |
150
+ | `include` | `'top-bar' \| 'shared-components'`| — | Bundle MI top-bar assets into the build (requires `standalone`) |
151
+ | `apiVersion` | `6 \| 7` | `7` | MI API version to target |
216
152
 
217
- | Option | Type | Default | Description |
218
- | ---------------------- | ----------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
219
- | `miHudLess` | boolean | `false` | Disables Metric Insights navigation bar in development |
220
- | `integrateMiTopBar` | boolean \| object | `false` | Integrates MI Top Bar and scripts into the App build (requires `miHudLess: true`). When `true`, enables both `addRootElement` and `addSharedComponentsScripts`. When an object, allows selective enabling: `{ addRootElement?: boolean, addSharedComponentsScripts?: boolean }` |
221
- | `templateLess` | boolean | `false` | Disables template variable transformation |
222
- | `enableProxyCache` | boolean | `true` | Enables caching of proxied requests |
223
- | `proxyCacheTTL` | number | `600000` | Cache TTL in milliseconds (10 minutes) |
224
- | `disableSSLValidation` | boolean | `false` | Disables SSL certificate validation for proxy requests |
225
- | `imageOptimizer` | boolean \| object | `true` | Controls image optimization. See [vite-plugin-image-optimizer](https://www.npmjs.com/package/vite-plugin-image-optimizer#plugin-options) for object options |
226
- | `outDir` | string | `dist` | Output directory for builds |
227
- | `distZip` | boolean \| object | `true` | Controls build output zipping. Object options: `{ outDir?: string, outFileName?: string }` |
228
- | `syncBackupsDir` | string | `backups` | Directory for asset backups from MI server |
229
- | `v7Features` | boolean | `false` | Enables Metric Insights v7 features |
230
- | `personalAccessToken` | string | `process.env.MI_ACCESS_TOKEN` | Personal Access Token for the MI instance |
153
+ ### `app` — Portal Page identity
231
154
 
232
- ### integrateMiTopBar Details
155
+ | Field | Type | Default | Description |
156
+ |--------|----------------------------|--------------------------|-------------------------------------------------------------|
157
+ | `id` | `number` | — | Portal Page ID used to fetch template variables |
158
+ | `type` | `'template' \| 'page'` | `'template'` | `template` syncs back to MI; `page` is standalone-only |
159
+ | `name` | `string` | `package.json#name` | Template name on the MI instance (usually auto-resolved) |
233
160
 
234
- The `integrateMiTopBar` option allows you to integrate the Metric Insights Top Bar and scripts directly into your application build. This is useful when you want to:
161
+ ### `proxy` — Request proxying
235
162
 
236
- 1. **Customize the Top Bar**: Modify the appearance and behavior of the MI navigation
237
- 2. **Bundle Integration**: Include MI scripts in your build instead of loading them dynamically
238
- 3. **Offline Development**: Work with MI features even when disconnected from the server
163
+ | Field | Type | Default | Description |
164
+ |---------------------|-----------|----------|------------------------------------------------------|
165
+ | `cache` | `boolean` | `true` | Enable caching of proxied requests |
166
+ | `cacheTtl` | `number` | `600000` | Cache TTL in milliseconds (10 minutes) |
167
+ | `tls.allowSelfSigned` | `boolean` | `false` | Allow self-signed SSL certificates on the MI server |
239
168
 
240
- **Important**: This option can only be enabled when `miHudLess` is set to `true`.
169
+ ### `build` — Build output
241
170
 
242
- #### Configuration Options
171
+ | Field | Type | Default | Description |
172
+ |---------------------|-------------------------------------------------------------|----------|--------------------------------------------------------------------------------------|
173
+ | `outDir` | `string` | `'dist'` | Output directory |
174
+ | `zip` | `boolean \| { fileName?: string; outDir?: string; inDir?: string }` | `true` | Zip build output. Object form customizes filename and directories. |
175
+ | `versionFile` | `boolean \| { enabled?: boolean; fileNameTemplate?: string }` | `true` | Write a VERSION file into the build |
176
+ | `imageOptimisations`| `boolean \| Record<string, unknown>` | `true` | Image optimization. See [vite-plugin-image-optimizer](https://www.npmjs.com/package/vite-plugin-image-optimizer#plugin-options) for object options |
243
177
 
244
- `integrateMiTopBar` can be configured in two ways:
178
+ ### `inspector` — Request Inspector
245
179
 
246
- **1. Boolean (Simple)**
180
+ | Field | Type | Default | Description |
181
+ |----------------|-----------|-------------|----------------------------------------------------------------|
182
+ | `enabled` | `boolean` | `true` | Enable the request inspector |
183
+ | `maxMemory` | `number` | `104857600` | Max total body memory (bytes) before oldest entries are evicted (default 100 MB) |
184
+ | `captureLimit` | `number` | `10485760` | Max body size captured per request/response (bytes, default 10 MB). Larger bodies are stored truncated. |
247
185
 
248
- - `true`: Enables both `addRootElement` and `addSharedComponentsScripts`
249
- - `false`: Disables integration (default)
186
+ ### `sync` — Template sync
250
187
 
251
- **2. Object (Advanced)**
188
+ | Field | Type | Default | Description |
189
+ |--------------|----------|-------------|-----------------------------------------|
190
+ | `backupsDir` | `string` | `'backups'` | Directory for backups from the MI server |
252
191
 
253
- - `addRootElement`: Adds `<div id="mi-react-root">` element to the body for React mounting
254
- - `addSharedComponentsScripts`: Adds MI shared component scripts and styles:
255
- - `/auth/info.js` - Authentication info script
256
- - `/js/main.js` - Main MI JavaScript bundle
257
- - `/css/main.css` - MI stylesheet
192
+ ### Validation
258
193
 
259
- #### Examples
260
-
261
- **Simple boolean configuration:**
262
-
263
- ```javascript
264
- // pp-dev.config.js
265
- module.exports = {
266
- backendBaseURL: 'https://mi.company.com',
267
- appId: 1,
268
- miHudLess: true, // Required: Disable dynamic MI scripts
269
- integrateMiTopBar: true, // Enable: Integrate Top Bar into build
270
- };
271
- ```
194
+ pp-dev validates your config at startup and reports problems clearly:
272
195
 
273
- **Advanced object configuration (selective features):**
196
+ | Condition | Behaviour |
197
+ |---|---|
198
+ | `mi.include` set + `mi.mode !== 'standalone'` | error |
199
+ | `mi.url` missing + `mi.mode === 'embedding'` or `app.type === 'template'` | error |
200
+ | `mi.url` missing + `mi.mode === 'standalone'` + `app.type === 'page'` | warning |
201
+ | `app.type === 'template'` without `app.id` | error |
202
+ | `app.type === 'page'` + `mi.mode === 'standalone'` without `app.id` | error |
203
+ | `app.name` missing and no `package.json#name` | error |
274
204
 
275
- ```javascript
276
- // pp-dev.config.js
277
- module.exports = {
278
- backendBaseURL: 'https://mi.company.com',
279
- appId: 1,
280
- miHudLess: true,
281
- integrateMiTopBar: {
282
- addRootElement: true, // Add root element for React
283
- addSharedComponentsScripts: true, // Add MI scripts and styles
284
- },
285
- };
286
- ```
205
+ ### Environment Variables
287
206
 
288
- **Partial integration (scripts only, manual root element):**
289
-
290
- ```javascript
291
- // pp-dev.config.js
292
- module.exports = {
293
- backendBaseURL: 'https://mi.company.com',
294
- appId: 1,
295
- miHudLess: true,
296
- integrateMiTopBar: {
297
- addRootElement: false, // Don't add root element
298
- addSharedComponentsScripts: true, // Add MI scripts and styles
299
- },
300
- };
301
- ```
302
-
303
- ### v7Features Details
304
-
305
- When enabled (`true`), this option:
306
-
307
- 1. Changes development path from `/pt/<portal-page-name>` to `/pl/<portal-page-name>`
308
- 2. Updates Code Sync feature to use v7.1.0+ URLs
309
-
310
- ### Personal Access Token
311
-
312
- The `personalAccessToken` option allows you to authenticate with the Metric Insights instance. You can set it in your configuration or use the `MI_ACCESS_TOKEN` environment variable.
313
-
314
- Example with authentication and Top Bar integration:
315
-
316
- ```javascript
317
- // pp-dev.config.js
318
- module.exports = {
319
- backendBaseURL: 'https://mi.company.com',
320
- appId: 1,
321
- personalAccessToken: process.env.MI_ACCESS_TOKEN,
322
- miHudLess: true,
323
- integrateMiTopBar: true,
324
- };
325
- ```
326
-
327
- **Environment Variable**: Set `MI_ACCESS_TOKEN` in your `.env` file:
328
-
329
- ```bash
330
- MI_ACCESS_TOKEN=your_token_here
331
- ```
207
+ | Variable | Description |
208
+ |-------------------|-------------------------------------------------|
209
+ | `MI_ACCESS_TOKEN` | Default value for `mi.token` when not set in config |
332
210
 
333
211
  **Local development and network exposure**: pp-dev is a **development** tool. It assumes a trusted machine. Personal access tokens and session helpers are still sensitive: they can authenticate to your Metric Insights backend as you.
334
212
 
335
- - Prefer binding the dev server to **`localhost`** when you do not need access from other devices. If you use **`--host`** (or equivalent) so the app listens on **all interfaces** or your LAN, other machines on the same network can reach the dev server and its dev-only routes (for example the in-browser token login flow). Treat that like exposing credentials: use only on networks you trust, or restrict access with your OS firewall.
336
- - Do not commit real tokens; keep them in `.env` (gitignored) or your secret store. Avoid sharing screen recordings or logs that contain `MI_ACCESS_TOKEN` or bearer tokens.
337
-
338
- ### Enhanced Authentication (v0.11.0+)
339
-
340
- The new authentication system in v0.11.0 provides:
341
-
342
- - **Automatic Environment Loading**: Automatically loads `MI_*` environment variables from `.env` files
343
- - **Token Validation**: Enhanced token validation and error handling
344
- - **Secure Headers**: Automatic header management for authenticated requests
345
- - **Connection Pooling**: Optimized HTTP connections for better performance
213
+ - Prefer binding the dev server to **`localhost`** when you do not need access from other devices. If you use **`--host`** (or equivalent) so the app listens on **all interfaces** or your LAN, other machines on the same network can reach the dev server and its dev-only routes. Treat that like exposing credentials: use only on networks you trust, or restrict access with your OS firewall.
214
+ - Do not commit real tokens; keep them in `.env` (gitignored) or your secret store.
346
215
 
347
- **Supported Environment Variables**:
216
+ ## Migrating from 0.x
348
217
 
349
- - `MI_ACCESS_TOKEN`: Personal access token for authentication
350
- - `MI_BACKEND_URL`: Alternative to `backendBaseURL` in config
351
- - `MI_APP_ID`: Alternative to `appId` in config
352
-
353
- **Automatic Loading**: pp-dev automatically detects and loads these variables from your project's `.env` file:
218
+ Run the built-in codemod to upgrade your config automatically:
354
219
 
355
220
  ```bash
356
- # .env
357
- MI_ACCESS_TOKEN=your_personal_access_token
358
- MI_BACKEND_URL=https://mi.company.com
359
- MI_APP_ID=123
221
+ npx @metricinsights/pp-dev migrate
360
222
  ```
361
223
 
224
+ Options:
225
+
226
+ | Option | Description |
227
+ |---|---|
228
+ | `[config]` | Path to config file (auto-detected if omitted) |
229
+ | `--dry-run` | Preview the migrated output without writing |
230
+ | `--format ts\|js\|json` | Override output format |
231
+ | `--output <file>` | Write to a specific file instead of overwriting |
232
+ | `--no-backup` | Skip creating a `.bak` backup of the original |
233
+
234
+ The command detects flat 0.x configs and legacy `pp-watch.config.*` files, converts them to the new grouped format, and writes a `.bak` backup before overwriting.
235
+
236
+ **Field mapping** (0.x → 1.0):
237
+
238
+ | 0.x | 1.0 |
239
+ |---|---|
240
+ | `backendBaseURL` | `mi.url` |
241
+ | `personalAccessToken` | `mi.token` |
242
+ | `miHudLess: true` | `mi.mode: 'standalone'` |
243
+ | `miHudLess: false` | `mi.mode: 'embedding'` |
244
+ | `integrateMiTopBar: true` | `mi.mode: 'standalone'`, `mi.include: 'top-bar'` |
245
+ | `integrateMiTopBar: { addSharedComponentsScripts: true }` | `mi.include: 'shared-components'` |
246
+ | `v7Features: true` | `mi.apiVersion: 7` |
247
+ | `v7Features: false` | `mi.apiVersion: 6` |
248
+ | `appId` / `portalPageId` | `app.id` |
249
+ | `templateName` | `app.name` (usually omit — auto-resolved from `package.json#name`) |
250
+ | `templateLess: true` | `app.type: 'page'` |
251
+ | `templateLess: false` | `app.type: 'template'` |
252
+ | `enableProxyCache` | `proxy.cache` |
253
+ | `proxyCacheTTL` | `proxy.cacheTtl` |
254
+ | `disableSSLValidation: true` | `proxy.tls.allowSelfSigned: true` |
255
+ | `distZip` | `build.zip` |
256
+ | `versionPlugin` | `build.versionFile` |
257
+ | `imageOptimizer` | `build.imageOptimisations` |
258
+ | `outDir` | `build.outDir` |
259
+ | `syncBackupsDir` | `sync.backupsDir` |
260
+
362
261
  ## CLI Commands
363
262
 
364
263
  ### Global Options
@@ -388,14 +287,11 @@ pp-dev [root] [options]
388
287
 
389
288
  **Development Shortcuts**:
390
289
 
391
- - `p` - Start/stop performance profiler (v0.11.0+)
392
290
  - `l` - Proxy re-login (refresh authentication)
393
291
  - `r` - Restart dev server
394
292
  - `u` - Show server URLs
395
293
  - `q` - Quit dev server
396
294
 
397
- **Performance Profiling**: Use the `p` shortcut to start/stop the Node.js profiler for detailed performance analysis during development.
398
-
399
295
  ### Next.js Development
400
296
 
401
297
  ```bash
@@ -423,6 +319,20 @@ pp-dev build [options]
423
319
  | `--assetsDir <dir>` | `assets` | Assets directory under outDir |
424
320
  | `--changelog [file]` | `true` | Create changelog file |
425
321
 
322
+ ### Migration
323
+
324
+ ```bash
325
+ pp-dev migrate [config] [options]
326
+ ```
327
+
328
+ | Option | Description |
329
+ |---|---|
330
+ | `[config]` | Config file to migrate (auto-detected if omitted) |
331
+ | `--dry-run` | Preview output without writing |
332
+ | `--format ts\|js\|json` | Output format |
333
+ | `--output <file>` | Write to a specific path |
334
+ | `--no-backup` | Skip `.bak` backup |
335
+
426
336
  ### Changelog Generation
427
337
 
428
338
  ```bash
@@ -454,7 +364,7 @@ pp-dev generate-icon-font [source] [destination] [options]
454
364
 
455
365
  ## Next.js Integration
456
366
 
457
- 1. Add pp-dev configuration to your project root
367
+ 1. Add a `pp-dev.config.ts` to your project root
458
368
  2. Update `package.json` scripts:
459
369
  ```json
460
370
  {
@@ -478,6 +388,68 @@ module.exports = withPPDev({
478
388
 
479
389
  For custom build configuration, create a `vite.config` file. See [Vite Configuration](https://vitejs.dev/config/) for details.
480
390
 
391
+ ## Request Inspector
392
+
393
+ pp-dev includes a built-in request inspector that captures every proxied and locally-served HTTP request made during development. It is enabled by default.
394
+
395
+ ### Web UI
396
+
397
+ Open `http://localhost:3000/@pp-dev/inspector` (replace port as needed) in any browser tab while the dev server is running. The UI shows:
398
+
399
+ - A scrollable list of captured requests with method, status, source badge, and timing
400
+ - Full request and response headers, with a **Copy** button per section
401
+ - Request and response bodies rendered as text for JSON/HTML/CSS/plain-text content types, with **Copy** and **Save** buttons
402
+ - Binary bodies (images, fonts, archives) show metadata only and offer a **Save** button
403
+ - A **Clear** button in the top-right removes all stored entries
404
+
405
+ ### Source badges
406
+
407
+ Each request in the list displays a colored letter badge to the left of the HTTP status:
408
+
409
+ | Badge | Color | Meaning |
410
+ |-------|--------|----------------------------------------------|
411
+ | `P` | Purple | Forwarded to the upstream Metric Insights server (proxy) |
412
+ | `C` | Amber | Served from the local proxy cache |
413
+ | `L` | Grey | Served locally (static file, dev route, etc.) |
414
+
415
+ ### Console banner
416
+
417
+ The dev panel script prints a one-line banner to the browser DevTools console when the page loads:
418
+
419
+ ```
420
+ pp-dev 🔍 Request Inspector → http://localhost:3000/@pp-dev/inspector
421
+ ```
422
+
423
+ The message persists in DevTools history so it is visible even when you open the console after the page has loaded.
424
+
425
+ ### REST API
426
+
427
+ The inspector also exposes a lightweight JSON API, useful for tooling and AI agents:
428
+
429
+ | Method | Path | Description |
430
+ |----------|-------------------------|---------------------------------------------|
431
+ | `GET` | `/@api/requests` | Paginated list of captured requests (metadata only, no bodies) |
432
+ | `GET` | `/@api/requests/:id` | Full entry including captured request/response bodies (base64-encoded) |
433
+ | `GET` | `/@api/requests/stats` | Store stats: entry count, memory usage, limits |
434
+ | `DELETE` | `/@api/requests` | Clear all stored entries |
435
+
436
+ `GET /@api/requests` accepts `?limit=` (default 50) and `?offset=` query parameters for pagination.
437
+
438
+ Bodies in `GET /@api/requests/:id` are returned as base64 strings in `requestBody` / `responseBody` fields alongside `requestContentType` / `responseContentType`. A `*Truncated: true` flag indicates the body exceeded `captureLimit` and was cut off.
439
+
440
+ ### Configuration
441
+
442
+ ```typescript
443
+ // pp-dev.config.ts
444
+ export default defineConfig({
445
+ inspector: {
446
+ enabled: true, // set to false to disable entirely
447
+ maxMemory: 100 * 1024 * 1024, // evict oldest entries above 100 MB
448
+ captureLimit: 10 * 1024 * 1024, // capture at most 10 MB per body
449
+ },
450
+ });
451
+ ```
452
+
481
453
  ## Troubleshooting
482
454
 
483
455
  ### Common Issues
@@ -510,8 +482,8 @@ If you encounter an error like "Next.js is required but not available":
510
482
  #### Version Compatibility
511
483
 
512
484
  - **pp-dev** requires Next.js version 15 or higher (but less than 17)
513
- - **Node.js** version 20 or higher is required
514
- - **TypeScript** version 4.2 or higher is supported
485
+ - **Node.js** version 24 or higher is required
486
+ - **TypeScript** version 5 or higher is recommended
515
487
 
516
488
  ### Getting Help
517
489