@axiomatic-labs/claudeflow 2.13.57 → 2.13.58

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 (2) hide show
  1. package/lib/panel.js +56 -0
  2. package/package.json +1 -1
package/lib/panel.js CHANGED
@@ -22,6 +22,7 @@ const {
22
22
  checkObserverState,
23
23
  readObserverState: readObserverStateFromDoctor,
24
24
  readPlaywrightCdpEndpoint,
25
+ applyCdpPortFix,
25
26
  } = require('./doctor.js');
26
27
  const {
27
28
  readOverrides,
@@ -205,6 +206,10 @@ function getMcpInfo(cwd) {
205
206
  configured: reading.state === 'ok' ? reading.port : null,
206
207
  computed: deriveCdpPort(cwd),
207
208
  match: cdp.severity === 'ok',
209
+ // `fixable` is true only for the "wrong port" mismatch case — the
210
+ // applyCdpPortFix routine can rewrite the args entry. Other cases
211
+ // (invalid JSON, unparseable value) can't be auto-fixed by the panel.
212
+ fixable: cdp.severity === 'mismatch',
208
213
  state: reading.state,
209
214
  message: cdp.message,
210
215
  },
@@ -1302,6 +1307,7 @@ function renderMcp() {
1302
1307
  \${row('Playwright --cdp-endpoint port', String(m.playwright.configured || 'n/a'))}
1303
1308
  \${row('Computed port (from path)', String(m.playwright.computed))}
1304
1309
  \${row('Match', m.playwright.match ? 'YES' : 'NO', { kind: m.playwright.match ? 'ok' : 'err', text: m.playwright.match ? '✓' : '✗' })}
1310
+ \${m.playwright.fixable ? '<div style="padding:10px 14px;border-top:1px solid var(--border);"><button id="fix-cdp-port" class="btn-warn">Fix CDP port</button> <span class="muted" style="margin-left:10px;font-size:12px;">Rewrites .mcp.json --cdp-endpoint to localhost:'+m.playwright.computed+' (the port this machine derives from the cwd).</span></div>' : ''}
1305
1311
  \${row('Observer', m.observer.running ? 'running (pid '+m.observer.pid+')' : 'STOPPED — browser errors NOT being collected', { kind: m.observer.running ? 'ok' : (m.playwright.match ? 'warn' : 'info'), text: m.observer.running ? '✓' : (m.playwright.match ? '⚠' : '·') })}
1306
1312
  \${!m.observer.running && m.playwright.match ? '<div style="padding:10px 14px;border-top:1px solid var(--border);"><button id="restart-observer" class="btn-warn">Restart observer</button> <span class="muted" style="margin-left:10px;font-size:12px;">Re-runs SessionStart/browser-error-daemon.js — spawns Chrome with --cdp-endpoint and registers the daemon pidfile.</span></div>' : ''}
1307
1313
  </div>
@@ -1416,8 +1422,32 @@ document.addEventListener('click', (e) => {
1416
1422
  if (t.id === 'restart-observer') {
1417
1423
  return restartObserverAction(t);
1418
1424
  }
1425
+ if (t.id === 'fix-cdp-port') {
1426
+ return fixCdpPortAction(t);
1427
+ }
1419
1428
  });
1420
1429
 
1430
+ async function fixCdpPortAction(btn) {
1431
+ const originalLabel = btn.textContent;
1432
+ btn.disabled = true;
1433
+ btn.textContent = 'Fixing…';
1434
+ try {
1435
+ const r = await fetch('/api/cdp-port/fix', { method: 'POST' });
1436
+ const result = await r.json();
1437
+ if (r.ok && result.ok) {
1438
+ showToast('CDP port fixed — .mcp.json rewritten. ' + (result.after && result.after.message || ''), 'ok');
1439
+ } else {
1440
+ showToast('Fix failed: ' + (result.error || 'unknown'), 'err');
1441
+ }
1442
+ } catch (e) {
1443
+ showToast('Network error: ' + e.message, 'err');
1444
+ } finally {
1445
+ btn.disabled = false;
1446
+ btn.textContent = originalLabel;
1447
+ await refresh();
1448
+ }
1449
+ }
1450
+
1421
1451
  async function restartObserverAction(btn) {
1422
1452
  const originalLabel = btn.textContent;
1423
1453
  btn.disabled = true;
@@ -1689,6 +1719,32 @@ function handler(cwd) {
1689
1719
  return send(status, JSON.stringify(result), 'application/json');
1690
1720
  }
1691
1721
 
1722
+ if (req.method === 'POST' && route === '/api/cdp-port/fix') {
1723
+ // Re-run checkCdpPortMismatch to get fresh state (the file may have
1724
+ // changed since the panel last fetched). Only apply the fix if the
1725
+ // check still reports severity='mismatch' (i.e. the wrong-port case
1726
+ // — other failure modes like invalid JSON cannot be auto-fixed).
1727
+ const check = checkCdpPortMismatch(cwd);
1728
+ if (check.severity !== 'mismatch') {
1729
+ return send(409, JSON.stringify({
1730
+ ok: false,
1731
+ error: `cdp-port check is "${check.severity}" — only "mismatch" is auto-fixable. Current message: ${check.message}`,
1732
+ check_severity: check.severity,
1733
+ }), 'application/json');
1734
+ }
1735
+ try {
1736
+ applyCdpPortFix(check);
1737
+ } catch (e) {
1738
+ return send(500, JSON.stringify({ ok: false, error: `applyCdpPortFix failed: ${e.message}` }), 'application/json');
1739
+ }
1740
+ const after = checkCdpPortMismatch(cwd);
1741
+ return send(200, JSON.stringify({
1742
+ ok: after.severity === 'ok',
1743
+ before: { severity: check.severity, message: check.message },
1744
+ after: { severity: after.severity, message: after.message },
1745
+ }), 'application/json');
1746
+ }
1747
+
1692
1748
  if (req.method === 'POST' && route === '/api/observer/restart') {
1693
1749
  // Re-run the SessionStart/browser-error-daemon.js hook script
1694
1750
  // synchronously. The script calls ensureObserver() which spawns
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiomatic-labs/claudeflow",
3
- "version": "2.13.57",
3
+ "version": "2.13.58",
4
4
  "description": "Claudeflow — AI-powered development toolkit for Claude Code. Skills, agents, hooks, and quality gates that ship production apps.",
5
5
  "bin": {
6
6
  "claudeflow": "./bin/cli.js"