pressship 0.1.0 → 0.1.2

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.
package/README.md CHANGED
@@ -1,102 +1,253 @@
1
- # Pressship
1
+ <p align="center">
2
+ <img src="assets/pressship.png" alt="Pressship" width="400">
3
+ </p>
2
4
 
3
- Pressship is a CLI for preparing, submitting, and releasing WordPress.org plugins.
5
+ <p align="center">
6
+ A modern CLI for preparing, validating, submitting, and releasing WordPress.org plugins from the terminal.
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://nodejs.org/"><img alt="Node.js 20+" src="https://img.shields.io/badge/node-%3E%3D20-339933?logo=node.js&logoColor=white"></a>
11
+ <a href="https://wordpress.org/plugins/developers/"><img alt="WordPress.org Plugin Directory" src="https://img.shields.io/badge/WordPress.org-plugin%20directory-3858e9?logo=wordpress&logoColor=white"></a>
12
+ <a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
13
+ </p>
14
+
15
+ <p align="center">
16
+ <strong>WordPress.org plugin publishing, but closer to <code>npm publish</code>.</strong>
17
+ </p>
18
+
19
+ It is designed to make WordPress plugin publishing feel closer to npm package publishing:
20
+
21
+ ```bash
22
+ npx pressship login
23
+ npx pressship publish ./my-plugin --dry-run
24
+ npx pressship publish ./my-plugin
25
+ ```
26
+
27
+ ## Why Pressship?
28
+
29
+ Publishing a WordPress plugin to WordPress.org involves a lot of small steps: creating the right zip, validating `readme.txt`, running Plugin Check, logging into WordPress.org, uploading through the developer page, and later publishing releases through SVN.
30
+
31
+ Pressship automates that workflow while still using WordPress.org's existing review and release systems.
32
+
33
+ ## Features
34
+
35
+ - Browser-based WordPress.org login with saved local session state.
36
+ - `whoami` and `logout` commands for session management.
37
+ - Plugin discovery from WordPress plugin headers.
38
+ - `readme.txt` parsing and local validation.
39
+ - WordPress.org readme validator automation.
40
+ - WordPress-installable zip generation.
41
+ - npm-style `publish` and `pack` commands.
42
+ - Managed WordPress.org Plugin Check setup and execution.
43
+ - Current WordPress.org submission state inspection.
44
+ - Pending-plugin reupload support via the WordPress.org developer page.
45
+ - SVN release workflow for approved plugins.
46
+ - Repeatable ignore globs and `.pressshipignore` support.
47
+ - Colorful CLI output with progress indicators.
48
+
49
+ ## Quick Start
4
50
 
5
51
  ```bash
52
+ # Authenticate with WordPress.org.
6
53
  npx pressship login
54
+
55
+ # Confirm the saved account.
7
56
  npx pressship whoami
8
- npx pressship logout
9
- npx pressship submit ./my-plugin
10
- npx pressship release ./my-plugin --slug my-plugin --username WpOrgUser
57
+
58
+ # Inspect current submitted plugin state.
59
+ npx pressship status ./my-plugin
60
+
61
+ # Validate and package without uploading or committing.
62
+ npx pressship publish ./my-plugin --dry-run
63
+
64
+ # Submit for review, reupload a pending plugin, or release an approved plugin.
65
+ npx pressship publish ./my-plugin
11
66
  ```
12
67
 
13
- ## What It Does
68
+ You can still use the explicit WordPress.org review and SVN flows:
14
69
 
15
- - Opens a real browser for WordPress.org login and stores only the browser session.
16
- - Installs Playwright Chromium automatically the first time browser automation needs it.
17
- - Discovers the main plugin file from WordPress plugin headers.
18
- - Parses `readme.txt` and runs local readme checks.
19
- - Validates `readme.txt` against the WordPress.org readme validator.
20
- - Builds a WordPress-installable zip with a single top-level plugin folder.
21
- - Runs `wp plugin check` when WP-CLI and the Plugin Check plugin are available.
22
- - Uploads the zip to the WordPress.org "Add your plugin" form after confirmation.
23
- - Publishes approved plugin updates to WordPress.org SVN trunk and tags.
70
+ ```bash
71
+ npx pressship submit ./my-plugin
72
+ npx pressship release ./my-plugin --slug my-plugin --username WpOrgUser
73
+ ```
24
74
 
25
75
  ## Requirements
26
76
 
27
77
  - Node.js 20 or newer.
28
78
  - A WordPress.org account.
29
- - Internet access the first time Pressship installs its browser automation runtime.
30
- - PHP for Pressship's managed Plugin Check runner when system WP-CLI is unavailable.
31
- - `svn` for `pressship release`.
79
+ - Internet access for first-run browser and Plugin Check setup.
80
+ - PHP for Pressship's managed Plugin Check environment when system WP-CLI is unavailable.
81
+ - `svn` for approved-plugin `pressship publish --release` and `pressship release`.
32
82
 
33
- ## Development
83
+ Pressship installs Playwright Chromium automatically when browser automation first needs it.
84
+
85
+ ## Command Overview
34
86
 
35
87
  ```bash
36
- npm install
37
- npm run dev -- --help
38
- npm run typecheck
39
- npm test
40
- npm run build
88
+ pressship login
89
+ pressship whoami [--json]
90
+ pressship logout
91
+ pressship status [plugin-path-or-slug] [--json]
92
+ pressship version <patch|minor|major> [plugin-path]
93
+ pressship pack [plugin-path] [options]
94
+ pressship publish [plugin-path] [options]
95
+ pressship submit [plugin-path] [options]
96
+ pressship release [plugin-path] [options]
41
97
  ```
42
98
 
43
- Until the package is published, use the local dev command:
99
+ ## Login Flow
44
100
 
45
101
  ```bash
46
- npm run dev -- login
47
- npm run dev -- whoami
48
- npm run dev -- logout
49
- npm run dev -- submit ./my-plugin --dry-run
50
- npm run dev -- release ./my-plugin --dry-run
102
+ pressship login
103
+ ```
104
+
105
+ Pressship opens `login.wordpress.org` in a real browser. Complete login manually, including any two-factor or account checks. Pressship waits until it detects a logged-in WordPress.org user, saves the browser session locally, and closes the browser.
106
+
107
+ Pressship does not store your WordPress.org password.
108
+
109
+ Useful commands:
110
+
111
+ ```bash
112
+ pressship whoami
113
+ pressship whoami --json
114
+ pressship logout
51
115
  ```
52
116
 
53
- ## Commands
117
+ ## Status Flow
54
118
 
55
- ### `pressship login`
119
+ ```bash
120
+ pressship status
121
+ pressship status ./my-plugin
122
+ pressship status my-plugin
123
+ pressship status my-plugin --json
124
+ ```
56
125
 
57
- Opens `login.wordpress.org` in a browser. Complete login manually, including any
58
- two-factor or account checks. Pressship waits for the page to show `Logged in user:`,
59
- verifies the WordPress.org account, saves Playwright storage state under your user
60
- config directory, and closes the browser. It does not store your WordPress.org
61
- password.
126
+ `status` reads the logged-in WordPress.org developer page and reports the current state of submitted plugins.
127
+
128
+ For pending submissions it can show:
129
+
130
+ - Review status.
131
+ - Assigned slug.
132
+ - Plugin ID.
133
+ - Submitted zip filename.
134
+ - Submitted version.
135
+ - Upload date.
136
+ - Plugin Check URL.
137
+ - Whether slug change is available.
138
+ - Whether updated zip upload is available.
139
+
140
+ When given a local plugin path, Pressship discovers the plugin headers and uses the inferred slug/name to find the matching WordPress.org submission.
141
+
142
+ Example output:
143
+
144
+ ```text
145
+ Pressmind
146
+ Status Awaiting Review — This plugin has not yet been reviewed.
147
+ Slug pressmind
148
+ Submitted May 14, 2026
149
+ Plugin ID 313331
150
+ Reupload available
151
+ Slug change available
152
+ File pressmind.zip
153
+ Version 0.0.3
154
+ ```
62
155
 
63
- If Chromium is not available yet, Pressship installs it automatically and retries
64
- the browser launch. As a fallback, run `npm run browsers:install` locally or
65
- `npx playwright install chromium` for a published install.
156
+ ## Version Flow
66
157
 
67
- ### `pressship whoami`
158
+ ```bash
159
+ pressship version patch
160
+ pressship version minor ./my-plugin
161
+ pressship version major ./my-plugin
162
+ ```
68
163
 
69
- Prints the WordPress.org username for the saved browser session:
164
+ `version` bumps local plugin metadata, similar to `npm version`.
165
+
166
+ It updates:
167
+
168
+ - The main plugin file `Version:` header.
169
+ - The `Stable tag:` value in `readme.txt`, when a readme exists.
170
+
171
+ Examples:
70
172
 
71
173
  ```bash
72
- pressship whoami
73
- pressship whoami --json
174
+ # 1.2.3 -> 1.2.4
175
+ pressship version patch
176
+
177
+ # 1.2.3 -> 1.3.0
178
+ pressship version minor ./my-plugin
179
+
180
+ # 1.2.3 -> 2.0.0
181
+ pressship version major ./my-plugin
74
182
  ```
75
183
 
76
- If no valid session is available, run `pressship login`.
184
+ ## Publish Flow
185
+
186
+ ```bash
187
+ pressship publish ./my-plugin
188
+ ```
77
189
 
78
- ### `pressship logout`
190
+ `publish` is the npm-style happy path. It discovers the plugin and then chooses the best WordPress.org publishing flow:
79
191
 
80
- Removes the saved WordPress.org browser session from Pressship's local config:
192
+ - Use `submit` when a matching WordPress.org review submission is pending or reuploadable.
193
+ - Use `release` when the plugin has an approved WordPress.org SVN repository and no pending review submission is found.
194
+ - Ask whether to submit or release when Pressship cannot confidently choose.
195
+
196
+ Useful options:
81
197
 
82
198
  ```bash
83
- pressship logout
199
+ pressship publish ./my-plugin --dry-run
200
+ pressship publish ./my-plugin --submit
201
+ pressship publish ./my-plugin --release --username WpOrgUser
202
+ pressship publish ./my-plugin --skip-plugin-check
203
+ pressship publish ./my-plugin --skip-readme-validator
204
+ pressship publish ./my-plugin --wp-path /path/to/wordpress
205
+ pressship publish ./my-plugin --ignore "assets/**/*.mp4"
206
+ pressship publish ./my-plugin --yes
84
207
  ```
85
208
 
86
- This does not change your WordPress.org account password or revoke other browser
87
- sessions. It only makes Pressship forget the saved session.
209
+ Use `--submit` for the review-upload flow and `--release` for the approved-plugin SVN flow when you want to be explicit.
88
210
 
89
- ### `pressship submit [plugin-path]`
211
+ ## Pack Flow
90
212
 
91
- Runs the full new-plugin review preparation flow:
213
+ ```bash
214
+ pressship pack ./my-plugin
215
+ ```
92
216
 
93
- 1. Detect the plugin main file and read `readme.txt`.
94
- 2. Run local readme checks.
95
- 3. Submit `readme.txt` content to the WordPress.org readme validator.
96
- 4. Create a submission zip.
97
- 5. Run Plugin Check against the staged package contents.
98
- 6. Ask for a final confirmation.
99
- 7. Upload the zip to `https://wordpress.org/plugins/developers/add/`.
217
+ `pack` validates the plugin, runs Plugin Check, and creates the WordPress-installable `{slug}.zip` without uploading or committing. By default, it writes the zip to the current directory, similar to `npm pack`.
218
+
219
+ Useful options:
220
+
221
+ ```bash
222
+ pressship pack ./my-plugin --output-dir ./build
223
+ pressship pack ./my-plugin --ignore "assets/**/*.mp4"
224
+ pressship pack ./my-plugin --skip-readme-validator
225
+ pressship pack ./my-plugin --wp-path /path/to/wordpress
226
+ pressship pack ./my-plugin --no-validate
227
+ pressship pack ./my-plugin --json
228
+ ```
229
+
230
+ Use `--no-validate` only when you intentionally want to create the zip without readme validation or Plugin Check.
231
+
232
+ ## Submit Flow
233
+
234
+ ```bash
235
+ pressship submit ./my-plugin
236
+ ```
237
+
238
+ `submit` is the explicit WordPress.org review preparation flow. It is equivalent to `publish --submit`:
239
+
240
+ 1. Discover the plugin main file.
241
+ 2. Parse WordPress plugin headers.
242
+ 3. Parse and validate `readme.txt`.
243
+ 4. Validate `readme.txt` with the WordPress.org readme validator.
244
+ 5. Build a WordPress-installable zip.
245
+ 6. Stage package contents for Plugin Check.
246
+ 7. Run the official WordPress.org Plugin Check.
247
+ 8. Ask for confirmation when blocking findings are reported.
248
+ 9. Upload the zip to WordPress.org.
249
+
250
+ If WordPress.org already has a pending submission matching the plugin slug or name, Pressship uses the "Upload updated plugin for review" form instead of the new-plugin form.
100
251
 
101
252
  Useful options:
102
253
 
@@ -106,55 +257,221 @@ pressship submit ./my-plugin --skip-plugin-check
106
257
  pressship submit ./my-plugin --skip-readme-validator
107
258
  pressship submit ./my-plugin --wp-path /path/to/wordpress
108
259
  pressship submit ./my-plugin --ignore "assets/**/*.mp4"
260
+ pressship submit ./my-plugin --ignore "assets/**/*.mp4" --ignore "docs/raw/**"
109
261
  pressship submit ./my-plugin --output-dir ./build
262
+ pressship submit ./my-plugin --yes
110
263
  ```
111
264
 
112
- By default, Pressship prepares a managed Plugin Check environment in its cache. It
113
- downloads WP-CLI when needed, downloads WordPress core, downloads the Plugin Check
114
- plugin, and runs `wp plugin check` with the correct `--path` and `--require`
115
- arguments. Pass `--wp-path /path/to/wordpress` only if you want to use your own
116
- WordPress installation instead.
265
+ ## Managed Plugin Check
266
+
267
+ By default, Pressship prepares its own local Plugin Check environment in your user config cache.
268
+
269
+ It can automatically:
270
+
271
+ - Use system WP-CLI when available.
272
+ - Download `wp-cli.phar` when system WP-CLI is unavailable.
273
+ - Download WordPress core.
274
+ - Create a managed `wp-config.php`.
275
+ - Install SQLite Database Integration for a local database-free setup.
276
+ - Run `wp core install` against the SQLite-backed local WordPress install.
277
+ - Download the WordPress.org Plugin Check plugin.
278
+ - Load Plugin Check with the required WP-CLI bootstrap file.
117
279
 
118
- The WordPress.org submission form is not a documented public API. Pressship uses
119
- browser automation and fails loudly, with a debug screenshot, if the form changes.
280
+ This means most users can run:
120
281
 
121
- ### `pressship release [plugin-path]`
282
+ ```bash
283
+ pressship submit ./my-plugin --dry-run
284
+ ```
122
285
 
123
- Publishes an approved plugin release to WordPress.org SVN:
286
+ without manually installing WordPress, WP-CLI, MySQL, or the Plugin Check plugin.
287
+
288
+ If you already have a local WordPress install with Plugin Check available, pass it explicitly:
289
+
290
+ ```bash
291
+ pressship submit ./my-plugin --wp-path /path/to/wordpress
292
+ ```
293
+
294
+ ## Release Flow
295
+
296
+ ```bash
297
+ pressship release ./my-plugin --slug my-plugin --username WpOrgUser
298
+ ```
299
+
300
+ WordPress.org initial review uses a zip upload. Approved plugin releases use SVN. Pressship keeps those workflows separate. `release` is equivalent to `publish --release`.
301
+
302
+ `release` will:
124
303
 
125
304
  1. Checkout or update `https://plugins.svn.wordpress.org/<slug>`.
126
- 2. Sync the packaged plugin files into `trunk/`.
305
+ 2. Sync packaged plugin files into `trunk/`.
127
306
  3. Create `tags/<version>` from trunk.
128
307
  4. Show `svn status`.
129
- 5. Commit after confirmation.
308
+ 5. Ask for confirmation.
309
+ 6. Commit the release.
130
310
 
131
311
  Useful options:
132
312
 
133
313
  ```bash
134
- pressship release ./my-plugin --slug my-plugin --username WpOrgUser
135
- pressship release ./my-plugin --version 1.2.3 --message "Release 1.2.3"
314
+ pressship release ./my-plugin --slug my-plugin
315
+ pressship release ./my-plugin --version 1.2.3
316
+ pressship release ./my-plugin --username WpOrgUser
317
+ pressship release ./my-plugin --message "Release 1.2.3"
136
318
  pressship release ./my-plugin --ignore "assets/**/*.mp4"
137
319
  pressship release ./my-plugin --dry-run
320
+ pressship release ./my-plugin --yes
138
321
  ```
139
322
 
140
323
  ## Packaging Rules
141
324
 
142
- Pressship excludes common development artifacts by default, including `.git`,
143
- `.gitignore`, `.github`, `node_modules`, `dist`, `build`, `coverage`, `tests`,
144
- `.env*`, log files, existing zips, `.pressshipignore`, and legacy `.pressportignore`.
145
-
146
- Add a `.pressshipignore` file in your plugin directory for project-specific
147
- exclusions.
325
+ Pressship creates a zip with one top-level plugin folder, matching the format expected by WordPress plugin upload.
326
+
327
+ It excludes common development artifacts by default:
328
+
329
+ - `.git`
330
+ - `.gitignore`
331
+ - `.github`
332
+ - `.DS_Store`
333
+ - `.idea`
334
+ - `.vscode`
335
+ - `.env`
336
+ - `.env.*`
337
+ - `node_modules`
338
+ - `dist`
339
+ - `build`
340
+ - `coverage`
341
+ - `tests`
342
+ - `*.log`
343
+ - `*.zip`
344
+ - `.pressshipignore`
345
+ - legacy `.pressportignore`
346
+
347
+ Add a `.pressshipignore` file in your plugin directory for project-specific exclusions:
348
+
349
+ ```gitignore
350
+ assets/**/*.mp4
351
+ docs/raw/**
352
+ playground/**
353
+ ```
148
354
 
149
- You can also ignore files per command with repeatable glob patterns:
355
+ You can also ignore files per command:
150
356
 
151
357
  ```bash
152
- pressship submit ./my-plugin --ignore "assets/**/*.mp4" --ignore "docs/raw/**"
358
+ pressship submit ./my-plugin --ignore "assets/**/*.mp4"
359
+ pressship publish ./my-plugin --ignore "assets/**/*.mp4"
360
+ pressship pack ./my-plugin --ignore "assets/**/*.mp4"
153
361
  pressship release ./my-plugin --ignore "assets/**/*.mp4"
154
362
  ```
155
363
 
156
- ## Notes
364
+ ## Configuration And Cache
365
+
366
+ Pressship stores local state under your user config directory:
367
+
368
+ ```text
369
+ ~/.config/pressship/
370
+ ```
371
+
372
+ This includes:
373
+
374
+ - WordPress.org browser session storage.
375
+ - Debug screenshots for failed browser automation.
376
+ - Managed Plugin Check cache.
377
+ - Managed WordPress core and SQLite setup.
378
+
379
+ You can override the config directory:
380
+
381
+ ```bash
382
+ PRESSSHIP_CONFIG_DIR=/tmp/pressship pressship status
383
+ ```
384
+
385
+ For migration compatibility, `PRESSPORT_CONFIG_DIR` is still accepted as a fallback.
386
+
387
+ ## Troubleshooting
388
+
389
+ ### Browser Runtime Missing
390
+
391
+ Pressship installs Chromium automatically. If that fails, run:
392
+
393
+ ```bash
394
+ npx playwright install chromium
395
+ ```
396
+
397
+ For local development:
398
+
399
+ ```bash
400
+ npm run browsers:install
401
+ ```
402
+
403
+ ### Not Logged In
404
+
405
+ Run:
406
+
407
+ ```bash
408
+ pressship login
409
+ pressship whoami
410
+ ```
411
+
412
+ If the saved session is stale:
413
+
414
+ ```bash
415
+ pressship logout
416
+ pressship login
417
+ ```
418
+
419
+ ### Plugin Check Setup Problems
420
+
421
+ The managed Plugin Check environment is automatic, but it still needs PHP and internet access on first run.
422
+
423
+ To bypass Plugin Check:
424
+
425
+ ```bash
426
+ pressship submit ./my-plugin --skip-plugin-check
427
+ ```
428
+
429
+ To use your own WordPress install:
430
+
431
+ ```bash
432
+ pressship submit ./my-plugin --wp-path /path/to/wordpress
433
+ ```
434
+
435
+ ### WordPress.org Form Changes
436
+
437
+ The WordPress.org submission and reupload flows are browser automation over the logged-in developer page, not a documented public API. If WordPress.org changes the form, Pressship fails loudly and saves a debug screenshot under the config directory.
438
+
439
+ ## Development
440
+
441
+ ```bash
442
+ npm install
443
+ npm run dev -- --help
444
+ npm run typecheck
445
+ npm test
446
+ npm run build
447
+ ```
448
+
449
+ Run local commands without publishing:
450
+
451
+ ```bash
452
+ npm run dev -- login
453
+ npm run dev -- whoami
454
+ npm run dev -- status
455
+ npm run dev -- pack ./my-plugin
456
+ npm run dev -- publish ./my-plugin --dry-run
457
+ npm run dev -- submit ./my-plugin --dry-run
458
+ npm run dev -- release ./my-plugin --dry-run
459
+ ```
460
+
461
+ Package smoke test:
462
+
463
+ ```bash
464
+ npm pack --dry-run
465
+ ```
466
+
467
+ ## Security Notes
468
+
469
+ - Pressship does not store your WordPress.org password.
470
+ - Login is completed in a real browser.
471
+ - Pressship stores Playwright browser session state locally.
472
+ - `logout` removes Pressship's saved local browser session.
473
+ - `logout` does not revoke other active WordPress.org sessions.
474
+
475
+ ## License
157
476
 
158
- Initial WordPress.org plugin review uses a zip upload. Approved plugin releases
159
- use SVN trunk and tags. Pressship keeps those workflows separate with `submit`
160
- and `release`.
477
+ MIT
Binary file
@@ -1,11 +1,11 @@
1
- import { openBrowserSession, saveBrowserSession } from "./session.js";
1
+ import { isLoggedIn, openBrowserSession, saveBrowserSession } from "./session.js";
2
2
  import { accountFromLoggedInCookie, accountFromLoggedInText, accountFromCurrentPageProfileLink } from "./whoami.js";
3
3
  import { ui } from "../ui.js";
4
4
  const loginTimeoutMs = 5 * 60 * 1000;
5
5
  const loginPollMs = 1_000;
6
6
  export async function login() {
7
7
  ui.intro("Login to WordPress.org");
8
- const { context, page } = await openBrowserSession({ headless: false });
8
+ const { context, page } = await openBrowserSession({ headless: false, useSavedSession: false });
9
9
  try {
10
10
  await page.goto("https://login.wordpress.org/", { waitUntil: "domcontentloaded" });
11
11
  ui.info("Complete the WordPress.org login in the opened browser. Pressship will continue automatically.");
@@ -19,21 +19,30 @@ export async function login() {
19
19
  const deadline = Date.now() + loginTimeoutMs;
20
20
  while (Date.now() < deadline) {
21
21
  const cookieAccount = await accountFromLoggedInCookie(context);
22
- if (cookieAccount) {
22
+ if (cookieAccount && (await sessionWorksOnWordPressOrg())) {
23
23
  return cookieAccount;
24
24
  }
25
25
  const linkAccount = await accountFromCurrentPageProfileLink(page).catch(() => undefined);
26
- if (linkAccount) {
26
+ if (linkAccount && (await sessionWorksOnWordPressOrg())) {
27
27
  return linkAccount;
28
28
  }
29
29
  const pageText = await page.locator("body").innerText({ timeout: 1_000 }).catch(() => "");
30
30
  const textAccount = accountFromLoggedInText(pageText);
31
- if (textAccount) {
31
+ if (textAccount && (await sessionWorksOnWordPressOrg())) {
32
32
  return textAccount;
33
33
  }
34
34
  await page.waitForTimeout(loginPollMs);
35
35
  }
36
36
  throw new Error("Timed out waiting for WordPress.org login. Run `pressship login` again.");
37
37
  }
38
+ async function sessionWorksOnWordPressOrg() {
39
+ const verificationPage = await context.newPage();
40
+ try {
41
+ return await isLoggedIn(verificationPage);
42
+ }
43
+ finally {
44
+ await verificationPage.close();
45
+ }
46
+ }
38
47
  }
39
48
  //# sourceMappingURL=login.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,iCAAiC,EAElC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAE9B,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACrC,MAAM,WAAW,GAAG,KAAK,CAAC;AAE1B,MAAM,CAAC,KAAK,UAAU,KAAK;IACzB,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACnC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,kBAAkB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;IAExE,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,IAAI,CAAC,8BAA8B,EAAE,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC,CAAC;QACnF,EAAE,CAAC,IAAI,CAAC,gGAAgG,CAAC,CAAC;QAE1G,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,iCAAiC,EAAE,sBAAsB,EAAE,CAAC,KAAK,EAAE,EAAE,CACjG,gBAAgB,KAAK,CAAC,QAAQ,EAAE,CACjC,CAAC;QAEF,MAAM,EAAE,CAAC,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAC9E,iDAAiD,OAAO,CAAC,QAAQ,GAAG,CACrE,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,OAAO,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC;IACnC,CAAC;IAED,KAAK,UAAU,sBAAsB;QAC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E,CAAC,SAAS,CAAC,CAAC;YACzF,IAAI,WAAW,IAAI,CAAC,MAAM,0BAA0B,EAAE,CAAC,EAAE,CAAC;gBACxD,OAAO,WAAW,CAAC;YACrB,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;YAC1F,MAAM,WAAW,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;YACtD,IAAI,WAAW,IAAI,CAAC,MAAM,0BAA0B,EAAE,CAAC,EAAE,CAAC;gBACxD,OAAO,WAAW,CAAC;YACrB,CAAC;YAED,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACzC,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC7F,CAAC;IAED,KAAK,UAAU,0BAA0B;QACvC,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACjD,IAAI,CAAC;YACH,OAAO,MAAM,UAAU,CAAC,gBAAgB,CAAC,CAAC;QAC5C,CAAC;gBAAS,CAAC;YACT,MAAM,gBAAgB,CAAC,KAAK,EAAE,CAAC;QACjC,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { type BrowserContext, type Page } from "playwright";
2
2
  export type BrowserSessionOptions = {
3
3
  headless?: boolean;
4
+ useSavedSession?: boolean;
4
5
  };
5
6
  export declare function openBrowserSession(options?: BrowserSessionOptions): Promise<{
6
7
  context: BrowserContext;
@@ -8,7 +8,9 @@ export async function openBrowserSession(options = {}) {
8
8
  await ensureConfigDir();
9
9
  const browser = await launchChromium(options);
10
10
  const storageStatePath = getStorageStatePath();
11
- const context = await browser.newContext(pathExists(storageStatePath) ? { storageState: storageStatePath } : undefined);
11
+ const context = await browser.newContext(options.useSavedSession !== false && pathExists(storageStatePath)
12
+ ? { storageState: storageStatePath }
13
+ : undefined);
12
14
  const page = await context.newPage();
13
15
  return { context, page };
14
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/auth/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAkC,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAErF,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAM/C,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,UAAiC,EAAE;IAEnC,MAAM,eAAe,EAAE,CAAC;IACxB,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAC/C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CACtC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,SAAS,CAC9E,CAAC;IACF,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;IAErC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAAuB;IAC9D,MAAM,eAAe,EAAE,CAAC;IACxB,MAAM,OAAO,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,C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