qfai 1.7.2 → 1.7.4

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 (36) hide show
  1. package/README.md +2 -2
  2. package/assets/init/.qfai/assistant/skills/qfai-discussion/SKILL.md +60 -1
  3. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/01_Context.md +2 -0
  4. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/02_Inception-Deck.md +2 -0
  5. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/03_Story-Workshop.md +33 -6
  6. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/05_Scope.md +2 -0
  7. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/06_REQ.md +2 -0
  8. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/07_NFR.md +2 -0
  9. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/08_Glossary.md +2 -0
  10. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/09_Constraints.md +2 -0
  11. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/10_Policy.md +2 -0
  12. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/11_OQ-Register.md +2 -0
  13. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/12_OQ-Resolution-Log.md +2 -0
  14. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/13_Deferred.md +2 -0
  15. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/14_Review-Request.md +11 -0
  16. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/99_delta.md +2 -0
  17. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/00_index.md +25 -0
  18. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/10_strategy.md +28 -0
  19. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/20_eval_axis_usability.md +26 -0
  20. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/21_eval_axis_consistency.md +26 -0
  21. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/22_eval_axis_accessibility.md +26 -0
  22. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/23_eval_axis_delight.md +34 -0
  23. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/30_comparison.md +30 -0
  24. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/31_anchor.md +27 -0
  25. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/40_contracts.md +30 -0
  26. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/50_review_bundle.md +31 -0
  27. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/60_critique_loop.md +23 -0
  28. package/dist/cli/index.cjs +87 -33
  29. package/dist/cli/index.cjs.map +1 -1
  30. package/dist/cli/index.mjs +87 -33
  31. package/dist/cli/index.mjs.map +1 -1
  32. package/dist/index.cjs +5 -5
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.mjs +5 -5
  35. package/dist/index.mjs.map +1 -1
  36. package/package.json +1 -1
@@ -1707,8 +1707,8 @@ var import_promises7 = require("fs/promises");
1707
1707
  var import_node_path8 = __toESM(require("path"), 1);
1708
1708
  var import_node_url2 = require("url");
1709
1709
  async function resolveToolVersion() {
1710
- if ("1.7.2".length > 0) {
1711
- return "1.7.2";
1710
+ if ("1.7.4".length > 0) {
1711
+ return "1.7.4";
1712
1712
  }
1713
1713
  try {
1714
1714
  const packagePath = resolvePackageJsonPath();
@@ -4116,7 +4116,10 @@ async function runPrototyping(options) {
4116
4116
  );
4117
4117
  await writeEvidence(
4118
4118
  evidencePath2,
4119
- applyRenderEvidence(skippedEvidence, renderOptions, false, renderBundle2?.path)
4119
+ applyRenderEvidence(
4120
+ skippedEvidence,
4121
+ await resolveAttachedRenderEvidence(renderBundle2, renderOptions, false)
4122
+ )
4120
4123
  );
4121
4124
  return 0;
4122
4125
  }
@@ -4160,7 +4163,10 @@ async function runPrototyping(options) {
4160
4163
  );
4161
4164
  await writeEvidence(
4162
4165
  evidencePath,
4163
- applyRenderEvidence(failedEvidence, renderOptions, true, renderBundle2?.path)
4166
+ applyRenderEvidence(
4167
+ failedEvidence,
4168
+ await resolveAttachedRenderEvidence(renderBundle2, renderOptions, true)
4169
+ )
4164
4170
  );
4165
4171
  info(`prototyping: wrote evidence with status=failed to ${evidencePath}`);
4166
4172
  return options.autogenOnly ? 1 : 0;
@@ -4188,7 +4194,10 @@ async function runPrototyping(options) {
4188
4194
  );
4189
4195
  await writeEvidence(
4190
4196
  evidencePath,
4191
- applyRenderEvidence(failedEvidence, renderOptions, true, renderBundle2?.path)
4197
+ applyRenderEvidence(
4198
+ failedEvidence,
4199
+ await resolveAttachedRenderEvidence(renderBundle2, renderOptions, true)
4200
+ )
4192
4201
  );
4193
4202
  info(`prototyping: wrote evidence with status=failed to ${evidencePath}`);
4194
4203
  return options.autogenOnly ? 1 : 0;
@@ -4210,7 +4219,10 @@ async function runPrototyping(options) {
4210
4219
  );
4211
4220
  await writeEvidence(
4212
4221
  evidencePath,
4213
- applyRenderEvidence(successEvidence, renderOptions, true, renderBundle?.path)
4222
+ applyRenderEvidence(
4223
+ successEvidence,
4224
+ await resolveAttachedRenderEvidence(renderBundle, renderOptions, true)
4225
+ )
4214
4226
  );
4215
4227
  const routeOkCount = result.crawled.filter((r) => r.status === "ok").length;
4216
4228
  const routeFailCount = result.crawled.filter((r) => r.status === "failed").length;
@@ -4249,46 +4261,43 @@ async function maybeWriteRenderBundle(toolVersion, command, options, autogenEnab
4249
4261
  if (!options.renderEvidence) {
4250
4262
  return void 0;
4251
4263
  }
4252
- const renderBundle = buildRenderBundle(toolVersion, command, options, autogenEnabled);
4264
+ const renderBundle = await buildRenderBundle(toolVersion, command, options, autogenEnabled);
4253
4265
  await writeRenderBundle(renderBundle.path, renderBundle.bundle);
4254
4266
  return renderBundle;
4255
4267
  }
4256
- function applyRenderEvidence(evidence, options, autogenEnabled, outputPath) {
4257
- if (!options.renderEvidence) {
4268
+ function applyRenderEvidence(evidence, renderEvidence) {
4269
+ if (!renderEvidence) {
4258
4270
  return evidence;
4259
4271
  }
4260
- const viewports = normalizeRenderViewports(options.renderViewports);
4261
4272
  return {
4262
4273
  ...evidence,
4263
- renderEvidence: {
4264
- status: autogenEnabled ? "requested" : "skipped",
4265
- requested: true,
4266
- autogenEnabled,
4267
- viewports,
4268
- outputPath: outputPath ?? resolveRenderOutPath(options.root, options.renderOut),
4269
- reason: autogenEnabled ? "render evidence capture not implemented in this slice" : "render requested without autogen-ui-fidelity"
4270
- }
4274
+ renderEvidence
4271
4275
  };
4272
4276
  }
4273
- function buildRenderBundle(toolVersion, command, options, autogenEnabled) {
4274
- const path64 = resolveRenderOutPath(options.root, options.renderOut);
4277
+ async function resolveAttachedRenderEvidence(renderBundle, options, autogenEnabled) {
4278
+ if (!options.renderEvidence) {
4279
+ return void 0;
4280
+ }
4281
+ return renderBundle?.renderEvidence ?? await buildRenderEvidenceRecord(
4282
+ options,
4283
+ autogenEnabled,
4284
+ resolveRenderOutPath(options.root, options.renderOut)
4285
+ );
4286
+ }
4287
+ async function buildRenderBundle(toolVersion, command, options, autogenEnabled) {
4288
+ const outPath = resolveRenderOutPath(options.root, options.renderOut);
4289
+ const renderEvidence = await buildRenderEvidenceRecord(options, autogenEnabled, outPath);
4275
4290
  return {
4276
- path: path64,
4291
+ path: outPath,
4277
4292
  bundle: {
4278
4293
  meta: {
4279
4294
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
4280
4295
  toolVersion,
4281
4296
  commands: [command]
4282
4297
  },
4283
- renderEvidence: {
4284
- status: autogenEnabled ? "requested" : "skipped",
4285
- requested: true,
4286
- autogenEnabled,
4287
- viewports: normalizeRenderViewports(options.renderViewports),
4288
- outputPath: path64,
4289
- reason: autogenEnabled ? "render evidence capture not implemented in this slice" : "render requested without autogen-ui-fidelity"
4290
- }
4291
- }
4298
+ renderEvidence
4299
+ },
4300
+ renderEvidence
4292
4301
  };
4293
4302
  }
4294
4303
  function mergeRenderOptions(options, configRenderEvidence) {
@@ -4300,6 +4309,7 @@ function mergeRenderOptions(options, configRenderEvidence) {
4300
4309
  ...options,
4301
4310
  renderEvidence: options.renderEvidence || configRenderEvidence?.enabled === true,
4302
4311
  renderViewports: mergedViewports,
4312
+ renderFailOpen: options.renderFailOpen ?? configRenderEvidence?.failOpen === true,
4303
4313
  ...renderOut ? { renderOut } : {},
4304
4314
  ...baseUrl ? { baseUrl } : {}
4305
4315
  };
@@ -4310,6 +4320,50 @@ function resolveRenderOutPath(root, explicit) {
4310
4320
  }
4311
4321
  return import_node_path17.default.resolve(root, ".qfai/evidence/render.json");
4312
4322
  }
4323
+ async function buildRenderEvidenceRecord(options, autogenEnabled, outputPath) {
4324
+ const viewports = normalizeRenderViewports(options.renderViewports);
4325
+ if (!autogenEnabled) {
4326
+ return {
4327
+ status: "skipped",
4328
+ requested: true,
4329
+ autogenEnabled: false,
4330
+ viewports,
4331
+ outputPath,
4332
+ reason: "render requested without autogen-ui-fidelity",
4333
+ skippedReason: "render requested without autogen-ui-fidelity"
4334
+ };
4335
+ }
4336
+ if (options.renderFailOpen) {
4337
+ try {
4338
+ await import("playwright");
4339
+ } catch (error2) {
4340
+ const skippedReason = describeUnavailablePlaywright(error2);
4341
+ return {
4342
+ status: "skipped",
4343
+ requested: true,
4344
+ autogenEnabled: true,
4345
+ viewports,
4346
+ outputPath,
4347
+ reason: skippedReason,
4348
+ skippedReason
4349
+ };
4350
+ }
4351
+ }
4352
+ return {
4353
+ status: "requested",
4354
+ requested: true,
4355
+ autogenEnabled: true,
4356
+ viewports,
4357
+ outputPath,
4358
+ reason: "render evidence capture not implemented in this slice"
4359
+ };
4360
+ }
4361
+ function describeUnavailablePlaywright(error2) {
4362
+ if (error2 instanceof Error && error2.message.trim().length > 0) {
4363
+ return `playwright unavailable: ${error2.message}`;
4364
+ }
4365
+ return `playwright unavailable: ${String(error2)}`;
4366
+ }
4313
4367
  function extractRouteHintsFromEvidence(evidence) {
4314
4368
  const routes = /* @__PURE__ */ new Set();
4315
4369
  const runtimeGate = evidence.runtimeGate;
@@ -9582,7 +9636,7 @@ async function readSafe7(filePath) {
9582
9636
  var import_promises30 = require("fs/promises");
9583
9637
  var import_node_path32 = __toESM(require("path"), 1);
9584
9638
  var MERMAID_FENCE_RE = /^\s*(?:`{3,}|~{3,})\s*mermaid\b/im;
9585
- var SCREEN_MOCK_HEADING_RE = /^\s*#{1,6}\s*screen mock\s*\(html\+css\)\s*$/im;
9639
+ var SCREEN_MOCK_HEADING_RE = /^\s*#{1,6}\s*screen mock(?:\s*[-\u2014]+\s*fallback)?\s*\(html\+css\)\s*$/im;
9586
9640
  var HTML_FENCE_RE = /^\s*(?:`{3,}|~{3,})\s*html\b/im;
9587
9641
  var CSS_FENCE_RE = /^\s*(?:`{3,}|~{3,})\s*css\b/im;
9588
9642
  var UI_HINT_RE = /\b(?:ui|ux|screen|screens|page|pages|layout|wireframe|mock|form|button|frontend|navigation)\b|画面|モック|遷移|フォーム|ボタン/i;
@@ -9628,7 +9682,7 @@ async function validateDiscussionVisuals(root) {
9628
9682
  "discussionVisuals.storyWorkshopMock",
9629
9683
  void 0,
9630
9684
  "change",
9631
- "UI \u8981\u4EF6\u304C\u3042\u308B\u5834\u5408\u306F `Screen Mock (HTML+CSS)` \u30BB\u30AF\u30B7\u30E7\u30F3\u3092\u8FFD\u52A0\u3057\u3001HTML/CSS \u30E2\u30C3\u30AF\u3092\u8A18\u8F09\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
9685
+ "UI \u8981\u4EF6\u304C\u3042\u308B\u5834\u5408\u306F `Screen Mock (HTML+CSS)` \u307E\u305F\u306F `Screen Mock \u2014 Fallback (HTML+CSS)` \u30BB\u30AF\u30B7\u30E7\u30F3\u3092\u8FFD\u52A0\u3057\u3001HTML/CSS \u30E2\u30C3\u30AF\u3092\u8A18\u8F09\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
9632
9686
  )
9633
9687
  );
9634
9688
  }
@@ -13437,7 +13491,7 @@ function findTopLevelComma(text) {
13437
13491
  // src/core/validators/htmlMockBlocks.ts
13438
13492
  var HTML_FENCE_RE2 = /```html\s*\r?\n([\s\S]*?)```/g;
13439
13493
  var ADJACENT_CSS_FENCE_RE = /^\s*```css\s*\r?\n([\s\S]*?)```/;
13440
- var SCREEN_MOCK_HEADING_RE2 = /^#{1,4}\s+(?:Screen\s+Mock\s*\(HTML\+CSS\)|HTML\+CSS\s+Visual\s+Mock(?:\s*[::].*)?)\s*$/gim;
13494
+ var SCREEN_MOCK_HEADING_RE2 = /^#{1,4}\s+(?:Screen\s+Mock(?:\s*[-\u2014]+\s*Fallback)?\s*\(HTML\+CSS\)|HTML\+CSS\s+Visual\s+Mock(?:\s*[::].*)?)\s*$/gim;
13441
13495
  var SCREEN_MOCK_COMMENT_RE = /<!--\s*Screen\s+Mock:\s*([^>\r\n]+?)\s*-->/gim;
13442
13496
  var NEXT_HEADING_RE = /^#{1,4}\s+/m;
13443
13497
  function collectHtmlMockBlocks(content) {