browser-debugger-cli 0.10.0 → 0.12.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 (103) hide show
  1. package/.claude/skills/bdg/SKILL.md +268 -0
  2. package/README.md +148 -74
  3. package/dist/commands/css.d.ts +13 -0
  4. package/dist/commands/css.js +53 -0
  5. package/dist/commands/dom/audit.d.ts +14 -0
  6. package/dist/commands/dom/audit.js +87 -0
  7. package/dist/commands/dom/formInteraction.js +36 -6
  8. package/dist/commands/dom/helpers/keyAttributes.d.ts +3 -2
  9. package/dist/commands/dom/helpers/keyAttributes.js +6 -4
  10. package/dist/commands/dom/helpers/screenshot.d.ts +1 -0
  11. package/dist/commands/dom/helpers/screenshot.js +158 -38
  12. package/dist/commands/dom/index.js +4 -1
  13. package/dist/commands/dom/screenshot.js +10 -6
  14. package/dist/commands/dom/wait.js +5 -3
  15. package/dist/commands/helpJson.js +1 -1
  16. package/dist/commands/installSkill.d.ts +20 -0
  17. package/dist/commands/installSkill.js +87 -0
  18. package/dist/commands/optionBehaviors.js +21 -6
  19. package/dist/commands/page.js +7 -4
  20. package/dist/commands/peek.d.ts +7 -0
  21. package/dist/commands/peek.js +65 -23
  22. package/dist/commands/shared/optionTypes.d.ts +5 -1
  23. package/dist/commands/start.d.ts +13 -0
  24. package/dist/commands/start.js +19 -2
  25. package/dist/commands/tail.d.ts +7 -1
  26. package/dist/commands/tail.js +13 -62
  27. package/dist/commands.js +5 -0
  28. package/dist/daemon/session/commandRegistry.js +7 -1
  29. package/dist/daemon/session/plugins.js +4 -52
  30. package/dist/daemon.js +7986 -6848
  31. package/dist/errors/messages.d.ts +50 -4
  32. package/dist/errors/messages.js +94 -5
  33. package/dist/index.js +709 -190
  34. package/dist/ipc/client.d.ts +4 -0
  35. package/dist/ipc/client.js +8 -0
  36. package/dist/ipc/protocol/auditTypes.d.ts +129 -0
  37. package/dist/ipc/protocol/auditTypes.js +6 -0
  38. package/dist/ipc/protocol/commands.d.ts +23 -0
  39. package/dist/ipc/protocol/commands.js +2 -0
  40. package/dist/ipc/protocol/domTypes.d.ts +4 -0
  41. package/dist/ipc/protocol/inspectTypes.d.ts +71 -8
  42. package/dist/runtime/css/search.d.ts +39 -0
  43. package/dist/runtime/css/search.js +122 -0
  44. package/dist/runtime/dom/actionEffects.d.ts +4 -1
  45. package/dist/runtime/dom/actionEffects.js +8 -4
  46. package/dist/runtime/dom/audit.d.ts +19 -0
  47. package/dist/runtime/dom/audit.js +36 -0
  48. package/dist/runtime/dom/auditModel.d.ts +45 -0
  49. package/dist/runtime/dom/auditModel.js +215 -0
  50. package/dist/runtime/dom/auditScripts.d.ts +107 -0
  51. package/dist/runtime/dom/auditScripts.js +112 -0
  52. package/dist/runtime/dom/elementGeometry.d.ts +8 -2
  53. package/dist/runtime/dom/elementGeometry.js +24 -8
  54. package/dist/runtime/dom/elementInfo.d.ts +3 -2
  55. package/dist/runtime/dom/elementInfo.js +8 -2
  56. package/dist/runtime/dom/formFillHelpers/fill.js +2 -2
  57. package/dist/runtime/dom/inspect.d.ts +7 -0
  58. package/dist/runtime/dom/inspect.js +88 -23
  59. package/dist/runtime/dom/inspectAllStyles.d.ts +16 -4
  60. package/dist/runtime/dom/inspectAllStyles.js +89 -7
  61. package/dist/runtime/dom/inspectCascade.d.ts +19 -2
  62. package/dist/runtime/dom/inspectCascade.js +214 -44
  63. package/dist/runtime/dom/inspectCascadeModel.d.ts +8 -0
  64. package/dist/runtime/dom/inspectCascadeModel.js +108 -34
  65. package/dist/runtime/dom/inspectHints.d.ts +26 -3
  66. package/dist/runtime/dom/inspectHints.js +125 -9
  67. package/dist/runtime/dom/inspectModel.d.ts +3 -0
  68. package/dist/runtime/dom/inspectModel.js +30 -7
  69. package/dist/runtime/dom/inspectPaintModel.d.ts +48 -22
  70. package/dist/runtime/dom/inspectPaintModel.js +180 -68
  71. package/dist/runtime/dom/inspectRules.d.ts +19 -0
  72. package/dist/runtime/dom/inspectRules.js +21 -5
  73. package/dist/runtime/dom/inspectScripts.d.ts +85 -12
  74. package/dist/runtime/dom/inspectScripts.js +314 -28
  75. package/dist/runtime/dom/inspectTree.js +10 -2
  76. package/dist/runtime/dom/inspectWhyModel.d.ts +2 -1
  77. package/dist/runtime/dom/inspectWhyModel.js +52 -10
  78. package/dist/runtime/dom/layout.js +31 -9
  79. package/dist/runtime/dom/reactEventHelpers.d.ts +7 -0
  80. package/dist/runtime/dom/reactEventHelpers.js +27 -9
  81. package/dist/runtime/page/emulation.d.ts +13 -4
  82. package/dist/runtime/page/emulation.js +69 -4
  83. package/dist/runtime/page/userAgent.d.ts +17 -0
  84. package/dist/runtime/page/userAgent.js +57 -0
  85. package/dist/types.d.ts +12 -0
  86. package/dist/ui/formatters/audit.d.ts +19 -0
  87. package/dist/ui/formatters/audit.js +106 -0
  88. package/dist/ui/formatters/dom.d.ts +1 -1
  89. package/dist/ui/formatters/dom.js +6 -3
  90. package/dist/ui/formatters/inspect.js +42 -15
  91. package/dist/ui/formatters/installSkill.d.ts +11 -0
  92. package/dist/ui/formatters/installSkill.js +31 -0
  93. package/dist/ui/formatters/status.js +1 -1
  94. package/dist/ui/messages/commands.d.ts +44 -7
  95. package/dist/ui/messages/commands.js +83 -11
  96. package/dist/ui/messages/preview.d.ts +6 -0
  97. package/dist/ui/messages/preview.js +9 -1
  98. package/dist/utils/cssValues.js +36 -4
  99. package/dist/utils/decisionTrees.js +0 -5
  100. package/dist/utils/suggestions.d.ts +4 -2
  101. package/dist/utils/suggestions.js +7 -5
  102. package/dist/utils/taskMappings.js +1 -1
  103. package/package.json +4 -2
@@ -691,7 +691,16 @@ export declare function elementNotVisibleError(): ErrorWithSuggestion;
691
691
  */
692
692
  export declare function elementZeroDimensionsError(): ErrorWithSuggestion;
693
693
  /**
694
- * Missing required argument.
694
+ * `bdg dom hover --off` was given an element too.
695
+ *
696
+ * @returns Message and suggestion
697
+ */
698
+ export declare function hoverOffWithTargetError(): ErrorWithSuggestion;
699
+ /**
700
+ * A command was given neither its argument nor a flag that replaces it.
701
+ *
702
+ * @param usage - How to call it
703
+ * @returns Message and suggestion
695
704
  */
696
705
  export declare function missingArgumentError(usage: string): ErrorWithSuggestion;
697
706
  /**
@@ -927,10 +936,16 @@ export declare function unexpectedResponseFormatError(context: string): ErrorWit
927
936
  */
928
937
  export declare function operationFailedError(operation: string, errorMessage: string): ErrorWithSuggestion;
929
938
  /**
930
- * `dom inspect --props` named a property the element has no value for.
939
+ * `--why all`: `all` resets every property, so there is no one cascade to show.
931
940
  *
932
- * @param names - Unknown property names
933
- * @param suggestions - Similar computed property names
941
+ * @returns Message and suggestion
942
+ */
943
+ export declare function whyAllPropertyError(): ErrorWithSuggestion;
944
+ /**
945
+ * Names given to --props or --why that are not CSS properties.
946
+ *
947
+ * @param names - Unknown names
948
+ * @param suggestions - Closest known names
934
949
  * @returns Message and suggestion
935
950
  */
936
951
  export declare function unknownCssPropertyError(names: string[], suggestions: string[]): ErrorWithSuggestion;
@@ -973,5 +988,36 @@ export declare function formInIframeError(iframeUrl: string, crossOrigin: boolea
973
988
  export declare function cdpCallError(method: string, message: string): ErrorWithSuggestion & {
974
989
  notFound: boolean;
975
990
  };
991
+ /**
992
+ * The skill file is not where the package should have it (a broken or
993
+ * partial install).
994
+ *
995
+ * @param source - Expected SKILL.md path
996
+ * @returns Message and suggestion
997
+ */
998
+ export declare function skillSourceMissingError(source: string): ErrorWithSuggestion;
999
+ /**
1000
+ * The skill could not be written to an agent's skill directory.
1001
+ *
1002
+ * @param path - Destination SKILL.md
1003
+ * @param reason - The file system error
1004
+ * @returns Message and suggestion
1005
+ */
1006
+ export declare function skillWriteFailedError(path: string, reason: string): ErrorWithSuggestion;
1007
+ /**
1008
+ * `bdg peek --interval` without `--follow`.
1009
+ *
1010
+ * @returns Message and suggestion
1011
+ */
1012
+ export declare function intervalWithoutFollowError(): ErrorWithSuggestion;
1013
+ /**
1014
+ * An unknown `dom audit` check.
1015
+ *
1016
+ * @param value - Name given
1017
+ * @param similar - Closest names
1018
+ * @param checks - Every check
1019
+ * @returns Message
1020
+ */
1021
+ export declare function unknownAuditCheckMessage(value: string, similar: string[], checks: readonly string[]): string;
976
1022
  export {};
977
1023
  //# sourceMappingURL=messages.d.ts.map
@@ -1025,9 +1025,25 @@ export function noNodesFoundError(selector, context = {}) {
1025
1025
  const note = unreachableElementsNote(selector, context.unsearched);
1026
1026
  return {
1027
1027
  message: `No nodes found matching "${selector}"`,
1028
- suggestion: withLoadingHint(joinLines(context.similar, context.shadowHost && shadowBoundaryLine(context.shadowHost), `${hidden}Verify the CSS selector is correct.`, note ? note : undefined), context.readyState, selector),
1028
+ suggestion: withLoadingHint(joinLines(context.similar, context.shadowHost && shadowBoundaryLine(context.shadowHost), shadowPseudoLine(selector), `${hidden}Verify the CSS selector is correct.`, note ? note : undefined), context.readyState, selector),
1029
1029
  };
1030
1030
  }
1031
+ /**
1032
+ * Advice for a selector with `::part()` or `::slotted()`, which name
1033
+ * pseudo-elements a page's stylesheet uses and never match an element.
1034
+ *
1035
+ * @param selector - Selector as given
1036
+ * @returns Line, or undefined for other selectors
1037
+ */
1038
+ function shadowPseudoLine(selector) {
1039
+ const part = /::part\(\s*([^)\s]+)\s*\)/.exec(selector)?.[1];
1040
+ if (part) {
1041
+ return `::part() styles a shadow part and selects nothing; bdg searches open shadow roots, so select the part itself: [part~="${part}"]`;
1042
+ }
1043
+ return /::slotted\(/.test(selector)
1044
+ ? '::slotted() selects nothing; select the slotted element itself (it is in the light DOM)'
1045
+ : undefined;
1046
+ }
1031
1047
  /**
1032
1048
  * Quote a value for a POSIX shell command line.
1033
1049
  *
@@ -1176,7 +1192,21 @@ export function elementZeroDimensionsError() {
1176
1192
  };
1177
1193
  }
1178
1194
  /**
1179
- * Missing required argument.
1195
+ * `bdg dom hover --off` was given an element too.
1196
+ *
1197
+ * @returns Message and suggestion
1198
+ */
1199
+ export function hoverOffWithTargetError() {
1200
+ return {
1201
+ message: '--off moves the mouse off the page; it takes no element',
1202
+ suggestion: 'Use bdg dom hover --off alone, or bdg dom hover <selector> to hover an element',
1203
+ };
1204
+ }
1205
+ /**
1206
+ * A command was given neither its argument nor a flag that replaces it.
1207
+ *
1208
+ * @param usage - How to call it
1209
+ * @returns Message and suggestion
1180
1210
  */
1181
1211
  export function missingArgumentError(usage) {
1182
1212
  return {
@@ -1644,10 +1674,21 @@ export function operationFailedError(operation, errorMessage) {
1644
1674
  };
1645
1675
  }
1646
1676
  /**
1647
- * `dom inspect --props` named a property the element has no value for.
1677
+ * `--why all`: `all` resets every property, so there is no one cascade to show.
1678
+ *
1679
+ * @returns Message and suggestion
1680
+ */
1681
+ export function whyAllPropertyError() {
1682
+ return {
1683
+ message: '--why takes one property; "all" resets every property',
1684
+ suggestion: 'Name the property you are after (e.g. --why color), or use --all to list the set ones',
1685
+ };
1686
+ }
1687
+ /**
1688
+ * Names given to --props or --why that are not CSS properties.
1648
1689
  *
1649
- * @param names - Unknown property names
1650
- * @param suggestions - Similar computed property names
1690
+ * @param names - Unknown names
1691
+ * @param suggestions - Closest known names
1651
1692
  * @returns Message and suggestion
1652
1693
  */
1653
1694
  export function unknownCssPropertyError(names, suggestions) {
@@ -1751,4 +1792,52 @@ export function cdpCallError(method, message) {
1751
1792
  notFound: false,
1752
1793
  };
1753
1794
  }
1795
+ /**
1796
+ * The skill file is not where the package should have it (a broken or
1797
+ * partial install).
1798
+ *
1799
+ * @param source - Expected SKILL.md path
1800
+ * @returns Message and suggestion
1801
+ */
1802
+ export function skillSourceMissingError(source) {
1803
+ return {
1804
+ message: `The bdg skill is missing from the installed package (${source})`,
1805
+ suggestion: 'Reinstall bdg: npm install -g browser-debugger-cli',
1806
+ };
1807
+ }
1808
+ /**
1809
+ * The skill could not be written to an agent's skill directory.
1810
+ *
1811
+ * @param path - Destination SKILL.md
1812
+ * @param reason - The file system error
1813
+ * @returns Message and suggestion
1814
+ */
1815
+ export function skillWriteFailedError(path, reason) {
1816
+ return {
1817
+ message: `Could not write ${path}: ${reason}`,
1818
+ suggestion: 'Check the permissions of that directory, or install for the other agent only (--claude or --agents)',
1819
+ };
1820
+ }
1821
+ /**
1822
+ * `bdg peek --interval` without `--follow`.
1823
+ *
1824
+ * @returns Message and suggestion
1825
+ */
1826
+ export function intervalWithoutFollowError() {
1827
+ return {
1828
+ message: '--interval sets how often --follow refreshes',
1829
+ suggestion: 'Add --follow, e.g. bdg peek --follow --interval 500',
1830
+ };
1831
+ }
1832
+ /**
1833
+ * An unknown `dom audit` check.
1834
+ *
1835
+ * @param value - Name given
1836
+ * @param similar - Closest names
1837
+ * @param checks - Every check
1838
+ * @returns Message
1839
+ */
1840
+ export function unknownAuditCheckMessage(value, similar, checks) {
1841
+ return `Unknown check "${value}"${similar.length > 0 ? `; did you mean ${similar[0]}?` : ''} (checks: ${checks.join(', ')})`;
1842
+ }
1754
1843
  //# sourceMappingURL=messages.js.map