@atlassian/chippy 0.0.1-beta.1 → 0.0.1-beta.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.
Files changed (54) hide show
  1. package/README.md +142 -54
  2. package/bin/chippy.mjs +53 -95
  3. package/bin/pack.mjs +20 -0
  4. package/bin/skill-dir.mjs +15 -0
  5. package/lib/avalanche.js +54 -23
  6. package/lib/avalanche.js.map +2 -2
  7. package/lib/bootstrap.js +20 -1
  8. package/lib/bootstrap.js.map +3 -3
  9. package/lib/extension/avalanche.es.js +173 -34
  10. package/lib/extension/avalanche.es.js.map +1 -1
  11. package/lib/extension/chippy-page-bridge.js +164 -44
  12. package/lib/mcp-skill/README.md +2 -4
  13. package/lib/mcp-skill/SKILL.md +21 -16
  14. package/lib/mcp-skill/extension/armed-reload-startup.js +83 -0
  15. package/lib/mcp-skill/extension/avalanche.es.js +173 -34
  16. package/lib/mcp-skill/extension/avalanche.es.js.map +1 -1
  17. package/lib/mcp-skill/extension/avalanche.iife.js +173 -34
  18. package/lib/mcp-skill/extension/avalanche.iife.js.map +1 -1
  19. package/lib/mcp-skill/extension/background.js +2 -0
  20. package/lib/mcp-skill/extension/chippy-page-bridge.js +164 -44
  21. package/lib/mcp-skill/extension/content-script.js +23 -0
  22. package/lib/mcp-skill/extension/devtools-hook-shim.js +18 -1
  23. package/lib/mcp-skill/extension/early-bootstrap.js +3 -1
  24. package/lib/mcp-skill/extension/manifest.json +1 -1
  25. package/lib/mcp-skill/extension/panel-settings.js +2 -20
  26. package/lib/mcp-skill/extension/startup-handoff.js +30 -0
  27. package/lib/mcp-skill/references/README.md +2 -2
  28. package/lib/mcp-skill/references/avalanche-detector.md +3 -3
  29. package/lib/mcp-skill/references/browser-runtime-api.md +4 -4
  30. package/lib/mcp-skill/references/command-output-formats.md +12 -2
  31. package/lib/mcp-skill/references/command-surface.md +6 -6
  32. package/lib/mcp-skill/references/mode-a-injection.md +43 -9
  33. package/lib/mcp-skill/references/playwright-cli-setup.md +5 -5
  34. package/lib/mcp-skill/references/playwright-probes.md +1 -1
  35. package/lib/mcp-skill/references/recipes.txt +1 -1
  36. package/lib/mcp-skill/references/stability-render.md +4 -4
  37. package/lib/mcp-skill/references/test-mode-playbook.md +2 -1
  38. package/lib/mcp-skill/references/troubleshooting.md +6 -1
  39. package/lib/mcp-skill/scripts/chippy-helper-server.js +116 -58
  40. package/lib/mcp-skill/scripts/chippy.sh +41 -7
  41. package/lib/mcp-skill/scripts/helper-access.js +20 -6
  42. package/lib/mcp-skill/scripts/helper-proxy.js +87 -0
  43. package/lib/mcp-skill/scripts/page-socket-trust.js +81 -0
  44. package/lib/plugin.js.map +2 -2
  45. package/lib/storybook/connection-fallback.jsx +1 -1
  46. package/lib/storybook/manager-owner.js +42 -0
  47. package/lib/storybook/manager.jsx +22 -0
  48. package/lib/storybook/preview.js +53 -18
  49. package/lib/storybook/setup.js +15 -4
  50. package/lib/types/chippy-bridge/fiber-source.d.ts +14 -3
  51. package/lib/types/chippy-bridge/react-renderer.d.ts +30 -5
  52. package/lib/types/chippy-bridge/recorded-source.d.ts +44 -0
  53. package/lib/types/debug-render/core.d.ts +6 -0
  54. package/package.json +3 -1
@@ -14,9 +14,8 @@
14
14
  * without duplicating the iteration (and its Map/entries quirks).
15
15
  */
16
16
  export type ReactRenderer = {
17
- currentDispatcherRef?: {
18
- current: unknown;
19
- } | null;
17
+ /** `{ current }` on React <=18; `ReactSharedInternals` (`H`) on React 19. */
18
+ currentDispatcherRef?: Record<string, unknown> | null;
20
19
  scheduleUpdate?: (fiber: unknown) => void;
21
20
  version?: string;
22
21
  rendererPackageName?: string;
@@ -34,8 +33,34 @@ export type DevtoolsHookLike = {
34
33
  */
35
34
  export declare function getReactRenderers(scope?: typeof globalThis): ReactRenderer[];
36
35
  /**
37
- * First renderer that exposes a usable `currentDispatcherRef`. Used by
38
- * debug-render to patch the hook dispatcher.
36
+ * The writable property that holds React's active hooks dispatcher.
37
+ *
38
+ * React <=18 injects `ReactCurrentDispatcher`, whose dispatcher lives at
39
+ * `current`. React 19 injects `ReactSharedInternals`, whose dispatcher lives
40
+ * at `H` (`current` does not exist there). React DevTools makes the same
41
+ * distinction in its own `getDispatcherRef`.
42
+ */
43
+ export type DispatcherSlot = {
44
+ owner: Record<string, unknown>;
45
+ key: 'current' | 'H';
46
+ };
47
+ export declare function dispatcherSlotOf(injected: unknown): DispatcherSlot | null;
48
+ /**
49
+ * First renderer that exposes a usable dispatcher slot. Used by debug-render
50
+ * when it must trap writes to the exact property React assigns.
51
+ */
52
+ export declare function getDispatcherSlot(scope?: typeof globalThis): DispatcherSlot | null;
53
+ /**
54
+ * Normalize a slot to a `{ current }` ref. A legacy ref is returned as-is; a
55
+ * React 19 internals object gets one stable accessor view that reads and
56
+ * writes `H`.
57
+ */
58
+ export declare function dispatcherRefOf(slot: DispatcherSlot): {
59
+ current: unknown;
60
+ };
61
+ /**
62
+ * First renderer's hooks dispatcher as a `{ current }` ref, across React
63
+ * versions. Used by debug replay to swap in its stub dispatcher.
39
64
  */
40
65
  export declare function getDispatcherRef(scope?: typeof globalThis): {
41
66
  current: unknown;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Correct React <=18 `_debugSource` lines through the served module.
3
+ *
4
+ * The JSX transform records `lineNumber`/`columnNumber` from the code it
5
+ * receives. When an earlier transform adds lines first, the recorded position
6
+ * points into that intermediate code rather than the authored file. For
7
+ * example, `@vitejs/plugin-react` adds a Fast Refresh header before esbuild
8
+ * compiles JSX, which shifts every recorded line in the module.
9
+ *
10
+ * The served module still contains the recorded literal, and its source map
11
+ * maps that literal to the JSX element in the authored file. This module finds
12
+ * the literal and the URLs that may serve the recorded file; the call-site
13
+ * resolver in fiber-source.ts fetches the module and applies the map.
14
+ */
15
+ export type RecordedSource = {
16
+ fileName: string;
17
+ lineNumber: number;
18
+ columnNumber: number | null;
19
+ };
20
+ export type ServedPosition = {
21
+ line: number;
22
+ column: number;
23
+ };
24
+ export type PageModules = {
25
+ origin: string;
26
+ /** Script and module URLs the page loaded, oldest first. */
27
+ resourceUrls: readonly string[];
28
+ /** Vite serves any allowed file from `/@fs/<absolute path>`. */
29
+ vite: boolean;
30
+ };
31
+ /**
32
+ * The position of the single debug literal for `source` in served code, or
33
+ * null when the literal is missing or appears more than once.
34
+ */
35
+ export declare function recordedLiteralPosition(code: string, source: RecordedSource): ServedPosition | null;
36
+ /**
37
+ * Same-origin URLs that may serve `fileName`, best match first: loaded modules
38
+ * whose path ends the recorded file path, newest first, then Vite's `/@fs`
39
+ * URL when the page runs on Vite.
40
+ */
41
+ export declare function servedModuleUrls(fileName: string, page: PageModules): string[];
42
+ /** Candidate module URLs for a recorded file on the current page. */
43
+ export declare function pageModuleUrls(fileName: string): string[];
44
+ export declare function baseName(path: string): string;
@@ -66,6 +66,12 @@ export declare function parseStackFrames(stack: string): StackFrame[];
66
66
  type DispatcherRef = {
67
67
  current: unknown;
68
68
  };
69
+ /**
70
+ * True for a hook frame, including qualified names. React 19's CommonJS build
71
+ * defines `exports.useState = function (...) {}`, which V8 names
72
+ * `exports.useState`; bundlers can produce similar `ns.useX` names.
73
+ */
74
+ export declare function isHookFrameName(name: string): boolean;
69
75
  export declare function createDebugRender(options?: {
70
76
  maxEventsPerComponent?: number;
71
77
  }): DebugRenderModule;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlassian/chippy",
3
- "version": "0.0.1-beta.1",
3
+ "version": "0.0.1-beta.2",
4
4
  "description": "React runtime inspection and Avalanche commit evidence",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -96,7 +96,9 @@
96
96
  "jsdom": "^26.1.0",
97
97
  "playwright": "^1.64.1",
98
98
  "react": "^18.3.1",
99
+ "react-19": "npm:react@19.2.0",
99
100
  "react-dom": "^18.3.1",
101
+ "react-dom-19": "npm:react-dom@19.2.0",
100
102
  "storybook": "^10.3.3",
101
103
  "typescript": "^5.9.3",
102
104
  "vite": "^6.4.1",