sinapse-ai 7.4.7 → 7.5.0

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 (29) hide show
  1. package/.claude/CLAUDE.md +10 -7
  2. package/.claude/rules/documentation-first.md +77 -0
  3. package/.claude/rules/mandatory-delegation.md +96 -0
  4. package/.codex/instructions.md +2 -1
  5. package/.sinapse-ai/constitution.md +59 -6
  6. package/.sinapse-ai/core/doctor/checks/constitution-consistency.js +116 -0
  7. package/.sinapse-ai/core/doctor/checks/index.js +10 -2
  8. package/.sinapse-ai/core/doctor/index.js +4 -3
  9. package/.sinapse-ai/core/health-check/checks/project/constitution-consistency.js +157 -0
  10. package/.sinapse-ai/core/health-check/checks/project/index.js +2 -0
  11. package/.sinapse-ai/data/entity-registry.yaml +807 -777
  12. package/.sinapse-ai/data/registry-update-log.jsonl +16 -0
  13. package/.sinapse-ai/development/tasks/dev-develop-story.md +14 -6
  14. package/.sinapse-ai/development/tasks/health-check.yaml +2 -2
  15. package/.sinapse-ai/development/templates/chrome-brain/knowledge-base/claude-in-chrome.md +62 -0
  16. package/.sinapse-ai/install-manifest.yaml +29 -17
  17. package/.sinapse-ai/product/templates/ide-rules/claude-rules.md +10 -6
  18. package/README.en.md +10 -8
  19. package/README.md +10 -8
  20. package/bin/modules/chrome-brain-installer.js +164 -29
  21. package/bin/sinapse.js +8 -0
  22. package/docs/framework/memory-lifecycle.md +1 -1
  23. package/docs/getting-started.md +2 -2
  24. package/docs/guides/user-guide.md +9 -7
  25. package/docs/guides/workflows/xref-phase6-supporting.md +1 -1
  26. package/docs/guides/workflows-guide.md +1 -1
  27. package/package.json +1 -1
  28. package/packages/sinapse-install/src/capabilities/chrome-brain.js +183 -12
  29. package/squads/claude-code-mastery/agents/project-integrator.md +1 -1
@@ -354,10 +354,12 @@ function mergeHooks() {
354
354
  PreToolUse: [
355
355
  { matcher: 'mcp__chrome-devtools__*', hooks: [{ type: 'command', command: ensureCmd }] },
356
356
  { matcher: 'mcp__claude-in-chrome__*', hooks: [{ type: 'command', command: ensureCmd }] },
357
+ { matcher: 'mcp__dev-browser__*', hooks: [{ type: 'command', command: ensureCmd }] },
357
358
  ],
358
359
  PostToolUse: [
359
360
  { matcher: 'mcp__chrome-devtools__*', hooks: [{ type: 'command', command: logCmd }] },
360
361
  { matcher: 'mcp__claude-in-chrome__*', hooks: [{ type: 'command', command: logCmd }] },
362
+ { matcher: 'mcp__dev-browser__*', hooks: [{ type: 'command', command: logCmd }] },
361
363
  ],
362
364
  };
363
365
 
@@ -378,14 +380,20 @@ function mergeHooks() {
378
380
  }
379
381
 
380
382
  /**
381
- * Adds Chrome DevTools MCP server to ~/.claude.json.
383
+ * Adds Chrome DevTools and dev-browser MCP servers to ~/.claude.json.
384
+ * Does NOT add claude-in-chrome — that extension manages its own MCP registration.
385
+ *
386
+ * @param {Object} osInfo - OS detection result from detectOS()
387
+ * @returns {string[]} List of errors (empty on success)
382
388
  */
383
389
  function mergeMcpConfig(osInfo) {
384
390
  const config = readJsonSafe(CLAUDE_JSON);
385
391
  if (!config.mcpServers) {
386
392
  config.mcpServers = {};
387
393
  }
394
+ const errors = [];
388
395
 
396
+ // --- Chrome DevTools MCP ---
389
397
  if (osInfo.type === OS_TYPE.WINDOWS) {
390
398
  config.mcpServers['chrome-devtools'] = {
391
399
  command: 'cmd',
@@ -398,7 +406,36 @@ function mergeMcpConfig(osInfo) {
398
406
  };
399
407
  }
400
408
 
409
+ // --- dev-browser MCP (Story 7.4.2) ---
410
+ // Install dev-browser globally first
411
+ try {
412
+ const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
413
+ execSync(`${npmCmd} install -g dev-browser`, { stdio: 'pipe', timeout: 120000 });
414
+ LOG.ok('dev-browser installed globally');
415
+ } catch (err) {
416
+ const msg = `dev-browser global install failed: ${err.message}. Manual install: npm install -g dev-browser`;
417
+ LOG.warn(msg);
418
+ errors.push('dev-browser-install');
419
+ // Do NOT throw — continue with rest of install
420
+ }
421
+
422
+ // Add dev-browser MCP entry regardless (user may install manually later)
423
+ if (osInfo.type === OS_TYPE.WINDOWS) {
424
+ config.mcpServers['dev-browser'] = {
425
+ command: 'cmd',
426
+ args: ['/c', 'dev-browser', '--connect'],
427
+ env: { CDP_URL: 'http://127.0.0.1:9222' },
428
+ };
429
+ } else {
430
+ config.mcpServers['dev-browser'] = {
431
+ command: 'dev-browser',
432
+ args: ['--connect'],
433
+ env: { CDP_URL: 'http://127.0.0.1:9222' },
434
+ };
435
+ }
436
+
401
437
  writeJson(CLAUDE_JSON, config);
438
+ return errors;
402
439
  }
403
440
 
404
441
  // ---------------------------------------------------------------------------
@@ -514,6 +551,21 @@ Quando encontrar barreira:
514
551
 
515
552
  ---
516
553
 
554
+ ## Browser Automation Tool Selection
555
+
556
+ | Task | Preferred Tool | Why |
557
+ |------|---------------|-----|
558
+ | Navigate, click, fill form | chrome-devtools-mcp (CDP) | Fastest, direct browser control |
559
+ | Screenshot, Lighthouse audit | chrome-devtools-mcp (CDP) | Built-in |
560
+ | Scraping with JS logic | dev-browser (Playwright) | evaluate(), full DOM access |
561
+ | Batch / loops / headless | dev-browser (Playwright) | Headless mode supported |
562
+ | Cross-origin iframes | dev-browser or CDP Input events | CDP has InputEvent.dispatch |
563
+ | Visual fallback, coordinates | claude-in-chrome extension | Screen-level computer use |
564
+
565
+ **Priority:** CDP > dev-browser > claude-in-chrome
566
+
567
+ ---
568
+
517
569
  ## Learnings Log
518
570
 
519
571
  > Secao atualizada automaticamente quando NSN Mode resolve problemas novos.
@@ -521,6 +573,76 @@ Quando encontrar barreira:
521
573
  `;
522
574
  }
523
575
 
576
+ /**
577
+ * Returns the content for the claude-in-chrome KB file.
578
+ * Provides setup instructions since the extension cannot be auto-installed.
579
+ */
580
+ function getClaudeInChromeKbContent() {
581
+ return `# claude-in-chrome — Chrome Extension for Visual Browser Interaction
582
+
583
+ > Manual install required. This extension cannot be auto-installed via CLI.
584
+
585
+ ---
586
+
587
+ ## What It Does
588
+
589
+ claude-in-chrome is a Chrome extension that acts as an MCP server directly from
590
+ within Chrome. It exposes browser automation tools via a local WebSocket, enabling
591
+ screen-level visual interaction (computer use) as a fallback when CDP and Playwright
592
+ cannot handle a task (e.g., complex visual layouts, canvas elements, iframes).
593
+
594
+ ---
595
+
596
+ ## Installation
597
+
598
+ 1. Open Chrome and navigate to the Chrome Web Store
599
+ 2. Search for "claude-in-chrome" or visit:
600
+ https://chromewebstore.google.com/detail/claude-in-chrome
601
+ 3. Click "Add to Chrome" and confirm
602
+ 4. The extension icon should appear in the Chrome toolbar
603
+ 5. Click the extension icon and follow the setup wizard
604
+
605
+ ---
606
+
607
+ ## MCP Configuration
608
+
609
+ The extension manages its own MCP registration automatically after install.
610
+ **Do NOT** manually add a "claude-in-chrome" entry to ~/.claude.json.
611
+
612
+ If the extension is installed and Chrome is running with debug port 9222,
613
+ claude-in-chrome tools will be available to Claude Code automatically.
614
+
615
+ ---
616
+
617
+ ## When to Use
618
+
619
+ | Scenario | Use claude-in-chrome? |
620
+ |----------|----------------------|
621
+ | CDP tools handle the task | No — use chrome-devtools-mcp |
622
+ | Playwright can scrape/interact | No — use dev-browser |
623
+ | Complex visual layout, canvas, WebGL | Yes |
624
+ | Cross-origin iframe interaction | Maybe — try CDP Input events first |
625
+ | Screen coordinate-based interaction | Yes |
626
+
627
+ **Priority:** CDP > dev-browser > claude-in-chrome (visual fallback only)
628
+
629
+ ---
630
+
631
+ ## Troubleshooting
632
+
633
+ - **Extension not showing tools:** Ensure Chrome is running with --remote-debugging-port=9222
634
+ - **Tools timeout:** Restart Chrome via chrome-debug script, then reload extension
635
+ - **Extension disabled:** Check chrome://extensions and re-enable
636
+
637
+ ---
638
+
639
+ ## Reference
640
+
641
+ - Master KB: ~/.sinapse/sinapse/knowledge-base/chrome-brain.md
642
+ - Chrome Brain auto-activation rule: ~/.sinapse/.claude/rules/chrome-brain-autoload.md
643
+ `;
644
+ }
645
+
524
646
  function getSquadIntegrationContent(squadName) {
525
647
  const footer = `## Tools Disponiveis
526
648
 
@@ -665,15 +787,20 @@ function installChromeBrain(options = {}) {
665
787
  }
666
788
  }
667
789
 
668
- // --- Step 4: MCP config ---
790
+ // --- Step 4: MCP config (chrome-devtools + dev-browser) ---
669
791
  if (!skipMcp) {
670
- LOG.step('Step 4 — Adding Chrome DevTools MCP to ~/.claude.json...');
792
+ LOG.step('Step 4 — Adding Chrome DevTools + dev-browser MCP to ~/.claude.json...');
671
793
  try {
672
794
  if (dryRun) {
673
- LOG.info('[DRY-RUN] Would merge MCP config');
795
+ LOG.info('[DRY-RUN] Would merge MCP config (chrome-devtools + dev-browser)');
674
796
  } else {
675
- mergeMcpConfig(osInfo);
676
- LOG.ok('Chrome DevTools MCP added to ~/.claude.json');
797
+ const mcpErrors = mergeMcpConfig(osInfo);
798
+ if (mcpErrors.length > 0) {
799
+ for (const e of mcpErrors) {
800
+ errors.push(e);
801
+ }
802
+ }
803
+ LOG.ok('Chrome DevTools + dev-browser MCP added to ~/.claude.json');
677
804
  }
678
805
  } catch (err) {
679
806
  const msg = `Failed to merge MCP config: ${err.message}`;
@@ -696,6 +823,11 @@ function installChromeBrain(options = {}) {
696
823
  content: getMasterKbContent(),
697
824
  label: 'master KB chrome-brain.md',
698
825
  },
826
+ {
827
+ path: path.join(SINAPSE_DIR, 'sinapse', 'knowledge-base', 'claude-in-chrome.md'),
828
+ content: getClaudeInChromeKbContent(),
829
+ label: 'claude-in-chrome.md KB',
830
+ },
699
831
  ];
700
832
 
701
833
  // Squad integration files
@@ -724,6 +856,15 @@ function installChromeBrain(options = {}) {
724
856
  }
725
857
  }
726
858
 
859
+ // --- claude-in-chrome instructions (Story 7.4.2) ---
860
+ if (!_quiet && !dryRun) {
861
+ LOG.step('Manual step required: claude-in-chrome extension');
862
+ LOG.info('Install the claude-in-chrome Chrome extension from the Chrome Web Store:');
863
+ LOG.info(' https://chromewebstore.google.com/detail/claude-in-chrome');
864
+ LOG.info('The extension manages its own MCP registration — no CLI config needed.');
865
+ LOG.info('See KB: ~/.sinapse/sinapse/knowledge-base/claude-in-chrome.md');
866
+ }
867
+
727
868
  // --- Step 6: Validate ---
728
869
  LOG.step('Step 6 — Validating installation...');
729
870
  if (!dryRun) {
@@ -792,6 +933,7 @@ function uninstallChromeBrain(options = {}) {
792
933
  const chromeMatchers = new Set([
793
934
  'mcp__chrome-devtools__*',
794
935
  'mcp__claude-in-chrome__*',
936
+ 'mcp__dev-browser__*',
795
937
  ]);
796
938
  let changed = false;
797
939
  for (const hookType of ['PreToolUse', 'PostToolUse']) {
@@ -819,16 +961,24 @@ function uninstallChromeBrain(options = {}) {
819
961
  errors.push(`Failed to clean hooks: ${err.message}`);
820
962
  }
821
963
 
822
- // --- Remove MCP from claude.json ---
964
+ // --- Remove MCP from claude.json (chrome-devtools + dev-browser) ---
823
965
  try {
824
966
  const config = readJsonSafe(CLAUDE_JSON);
825
- if (config.mcpServers && config.mcpServers['chrome-devtools']) {
967
+ let mcpChanged = false;
968
+ if (config.mcpServers) {
969
+ for (const key of ['chrome-devtools', 'dev-browser']) {
970
+ if (config.mcpServers[key]) {
971
+ delete config.mcpServers[key];
972
+ mcpChanged = true;
973
+ }
974
+ }
975
+ }
976
+ if (mcpChanged) {
826
977
  if (dryRun) {
827
- LOG.info('[DRY-RUN] Would remove chrome-devtools from ~/.claude.json');
978
+ LOG.info('[DRY-RUN] Would remove chrome-devtools + dev-browser from ~/.claude.json');
828
979
  } else {
829
- delete config.mcpServers['chrome-devtools'];
830
980
  writeJson(CLAUDE_JSON, config);
831
- LOG.ok('Removed chrome-devtools MCP from ~/.claude.json');
981
+ LOG.ok('Removed chrome-devtools + dev-browser MCP from ~/.claude.json');
832
982
  }
833
983
  removed.push(CLAUDE_JSON);
834
984
  }
@@ -841,6 +991,7 @@ function uninstallChromeBrain(options = {}) {
841
991
  const kbPaths = [
842
992
  path.join(SINAPSE_DIR, '.claude', 'rules', 'chrome-brain-autoload.md'),
843
993
  path.join(SINAPSE_DIR, 'sinapse', 'knowledge-base', 'chrome-brain.md'),
994
+ path.join(SINAPSE_DIR, 'sinapse', 'knowledge-base', 'claude-in-chrome.md'),
844
995
  ];
845
996
  for (const squad of SQUAD_NAMES) {
846
997
  kbPaths.push(path.join(SINAPSE_DIR, squad, 'knowledge-base', 'chrome-brain-integration.md'));
@@ -911,15 +1062,27 @@ function getChromeBrainStatus() {
911
1062
  // not configured
912
1063
  }
913
1064
 
914
- // Check MCP
1065
+ // Check MCP (chrome-devtools + dev-browser)
915
1066
  let mcpConfigured = false;
1067
+ let devBrowserMcpConfigured = false;
916
1068
  try {
917
1069
  const config = readJsonSafe(CLAUDE_JSON);
918
1070
  mcpConfigured = !!config.mcpServers?.['chrome-devtools'];
1071
+ devBrowserMcpConfigured = !!config.mcpServers?.['dev-browser'];
919
1072
  } catch {
920
1073
  // not configured
921
1074
  }
922
1075
 
1076
+ // Check dev-browser global install
1077
+ let devBrowserInstalled = false;
1078
+ try {
1079
+ const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
1080
+ execSync(`${npmCmd} list -g dev-browser`, { stdio: 'pipe', timeout: 10000 });
1081
+ devBrowserInstalled = true;
1082
+ } catch {
1083
+ // not installed globally
1084
+ }
1085
+
923
1086
  // Check rule
924
1087
  const ruleInstalled = fs.existsSync(
925
1088
  path.join(SINAPSE_DIR, '.claude', 'rules', 'chrome-brain-autoload.md'),
@@ -930,6 +1093,11 @@ function getChromeBrainStatus() {
930
1093
  path.join(SINAPSE_DIR, 'sinapse', 'knowledge-base', 'chrome-brain.md'),
931
1094
  );
932
1095
 
1096
+ // Check claude-in-chrome KB
1097
+ const claudeInChromeKbInstalled = fs.existsSync(
1098
+ path.join(SINAPSE_DIR, 'sinapse', 'knowledge-base', 'claude-in-chrome.md'),
1099
+ );
1100
+
933
1101
  // Count squad KBs
934
1102
  let squadKbCount = 0;
935
1103
  for (const squad of SQUAD_NAMES) {
@@ -943,8 +1111,11 @@ function getChromeBrainStatus() {
943
1111
  scriptsInstalled,
944
1112
  hooksConfigured,
945
1113
  mcpConfigured,
1114
+ devBrowserInstalled,
1115
+ devBrowserMcpConfigured,
946
1116
  ruleInstalled,
947
1117
  masterKbInstalled,
1118
+ claudeInChromeKbInstalled,
948
1119
  squadKbComplete: squadKbCount === SQUAD_NAMES.length,
949
1120
  };
950
1121
 
@@ -130,7 +130,7 @@ persona:
130
130
  # === SINAPSE Integration Principles ===
131
131
  - "L1-L4 Boundary Respect -- Framework core (L1) is immutable. Templates (L2) are extend-only. Project config (L3) is mutable with exceptions. Project runtime (L4) is where work happens."
132
132
  - "Task-First Architecture -- Workflows are composed by tasks connected, not by agents connected. Each task defines inputs, outputs, pre/post-conditions."
133
- - "Constitutional Compliance -- Every integration respects SINAPSE Constitution. CLI First, Agent Authority, Story-Driven Development, No Invention, Quality First."
133
+ - "Constitutional Compliance -- Every integration respects SINAPSE Constitution. CLI First, Agent Authority, Documentation-First Development, No Invention, Quality First, Mandatory Delegation."
134
134
 
135
135
  responsibility_boundaries:
136
136
  primary_scope: