@ihyeon/flow-qa 0.2.1 → 0.2.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.ko.md CHANGED
@@ -16,7 +16,7 @@ CLI와 `127.0.0.1` 전용 웹 UI를 제공합니다. UI는 영어로 시작하
16
16
  Node.js 24.8 이상이 필요합니다. 브라우저는 첫 웹 실행 전에 설치합니다.
17
17
 
18
18
  ```sh
19
- npm install -g @ihyeon/flow-qa@0.2.1
19
+ npm install -g @ihyeon/flow-qa@0.2.2
20
20
  flow-qa browser install
21
21
  flow-qa ui --demo
22
22
  ```
package/README.md CHANGED
@@ -16,7 +16,7 @@ Flow QA is available as a CLI and a web UI bound to `127.0.0.1`. Provide a targe
16
16
  Node.js 24.8 or later is required. Install Chromium before the first web run:
17
17
 
18
18
  ```sh
19
- npm install -g @ihyeon/flow-qa@0.2.1
19
+ npm install -g @ihyeon/flow-qa@0.2.2
20
20
  flow-qa browser install
21
21
  flow-qa ui --demo
22
22
  ```
@@ -253,6 +253,19 @@
253
253
  }); }
254
254
  async function prompt() { await work(async () => { const flow = $('flow-input').value.trim(); if (!flow) throw localizedError('app.enterFlow'); const result = await api('/api/prompt', { flow, platform: $('scenario-platform').value }); download('flow-qa-prompt.md', result.prompt, 'text/markdown'); noticeKey('app.promptDownloaded'); }); }
255
255
  function editableFlow(flow) { return flow.replace(/\r\n?/g, '\n'); }
256
+ function hasUnsavedScenario() {
257
+ const flow = $('flow-input').value;
258
+ const suite = $('suite-editor').value;
259
+ if (!app.savedFile) return !!(flow.trim() || suite.trim());
260
+ return flow !== editableFlow(app.sourceFlow)
261
+ || suite !== JSON.stringify(app.draft, null, 2)
262
+ || $('scenario-platform').value !== suitePlatform();
263
+ }
264
+ function warnBeforeUnload(event) {
265
+ if (!hasUnsavedScenario()) return;
266
+ event.preventDefault();
267
+ event.returnValue = '';
268
+ }
256
269
  async function importFiles() {
257
270
  const files = [...$('import-json').files, ...$('import-markdown').files];
258
271
  let imported = false;
@@ -368,6 +381,7 @@
368
381
  else if (!$('notice').hidden) notice(''); // A server error has no stable code to translate; the next request uses the selected language.
369
382
  }
370
383
  function wire() {
384
+ window.addEventListener('beforeunload', warnBeforeUnload);
371
385
  document.querySelectorAll('[data-view]').forEach((button) => button.addEventListener('click', () => view(button.dataset.view)));
372
386
  $('nav-toggle').addEventListener('click', () => { const open = $('sidebar').classList.toggle('nav-open'); $('nav-toggle').setAttribute('aria-expanded', String(open)); });
373
387
  $('library-shortcut').addEventListener('click', () => view('library'));
package/docs/mobile.md CHANGED
@@ -9,7 +9,7 @@ Choose **Mobile** on the scenario screen, describe the flow, and generate or dow
9
9
  With the installed CLI:
10
10
 
11
11
  ```sh
12
- npm install -g @ihyeon/flow-qa@0.2.1
12
+ npm install -g @ihyeon/flow-qa@0.2.2
13
13
  flow-qa init ./my-qa
14
14
  # Write your mobile flow in my-qa/flows/my-flow.md first.
15
15
  flow-qa plan flows/my-flow.md --platform mobile --prompt-only --workspace ./my-qa
package/docs/releases.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  The alpha entries below are historical release records. They document earlier package versions and checks.
4
4
 
5
+ ## 0.2.2: warn before leaving an unsaved draft
6
+
7
+ Requests the browser's confirmation before a refresh or tab close would discard an unsaved scenario or TC draft. Imported and manually edited cases are covered, including scenario edits to a saved case without a linked source. Unchanged saved cases stay quiet, and successful saving clears the warning. The browser controls the prompt; this does not add automatic saving or change review and execution gates.
8
+
9
+ Locally verified on macOS with Node.js 24.14.1 on 2026-10-20: 92 tests, type checking, UI syntax and design-system audit, a real Chromium reload prompt that preserves input when dismissed, clean/saved/imported/edited draft checks, existing browser and UI smoke tests, and a fresh tarball install with three passing browser cases. No model calls were used.
10
+
11
+ - Package: [`@ihyeon/flow-qa@0.2.2`](https://www.npmjs.com/package/@ihyeon/flow-qa/v/0.2.2)
12
+ - Release: [GitHub 0.2.2](https://github.com/hyeonse-swing/flow-qa/releases/tag/v0.2.2)
13
+
5
14
  ## 0.2.1: import case files from the UI
6
15
 
7
16
  Adds a file picker for a TC JSON file and its optional source Markdown. Import checks the suite and source hash before replacing the current draft, preserves unresolved review questions, and creates a separate copy when saved. Source text retains its line endings and trailing whitespace. This does not import error-to-test provenance metadata; original bundles remain separate. See [case file import](ui.md#import-existing-case-files).
package/docs/ui.md CHANGED
@@ -7,7 +7,7 @@ Describe a user flow, review cases, and configure a target when ready to run. We
7
7
  Node.js 24.8 or later is required. Install Flow QA and start the web demo:
8
8
 
9
9
  ```sh
10
- npm install -g @ihyeon/flow-qa@0.2.1
10
+ npm install -g @ihyeon/flow-qa@0.2.2
11
11
  flow-qa browser install
12
12
  flow-qa ui --demo
13
13
  ```
@@ -42,6 +42,8 @@ For each attempt, the report can open or download an approved screenshot or text
42
42
 
43
43
  To enter fresh JSON after changing a scenario, open the JSON editor in case review and choose **New JSON draft**. Existing saved files remain; validate and save the new JSON before reviewing it for a run.
44
44
 
45
+ From version `0.2.2`, the UI requests the browser's leave-page confirmation when refreshing or closing a tab with an unsaved scenario or case draft. Unchanged saved cases do not trigger it; saving clears the warning. Choose to stay on the page to keep editing. The browser controls the prompt wording and availability. This is not automatic saving, and it does not guard actions within the UI that replace the draft.
46
+
45
47
  ### Import existing case files
46
48
 
47
49
  From version `0.2.1`, select a `flow-qa/suite-1` JSON file and, when it declares a source, its Markdown file in case review, then choose **Import case files**. The two file controls let you select files from different folders. For an error-to-test export, select `cases/error-to-test.json` and `flows/error-to-test.md`. A JSON file without a source can be imported alone or with a Markdown file.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ihyeon/flow-qa",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "license": "MIT",
5
5
  "author": "Hyeonse Im",
6
6
  "repository": {