@atlassian/chippy 0.0.0-stage → 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.
- package/LICENSE +201 -0
- package/README.md +276 -2
- package/bin/chippy.mjs +92 -0
- package/bin/pack.mjs +204 -0
- package/bin/skill-dir.mjs +15 -0
- package/lib/avalanche.js +2601 -0
- package/lib/avalanche.js.map +7 -0
- package/lib/bootstrap.d.ts +1 -0
- package/lib/bootstrap.js +70 -0
- package/lib/bootstrap.js.map +7 -0
- package/lib/browser.js +15 -0
- package/lib/browser.js.map +7 -0
- package/lib/extension/avalanche.es.js +5535 -0
- package/lib/extension/avalanche.es.js.map +1 -0
- package/lib/extension/chippy-page-bridge.js +1953 -0
- package/lib/extension/inspect-react.js +216 -0
- package/lib/extension/layout-lab.js +1453 -0
- package/lib/extension/panel-dom.js +90 -0
- package/lib/extension/resolve-probes.js +342 -0
- package/lib/mcp-skill/LICENSE +201 -0
- package/lib/mcp-skill/README.md +148 -0
- package/lib/mcp-skill/SKILL.md +335 -0
- package/lib/mcp-skill/browser-scripts/playwright-probes.js +368 -0
- package/lib/mcp-skill/browser-scripts/playwright-session.js +114 -0
- package/lib/mcp-skill/extension/armed-reload-startup.js +83 -0
- package/lib/mcp-skill/extension/avalanche.es.js +5535 -0
- package/lib/mcp-skill/extension/avalanche.es.js.map +1 -0
- package/lib/mcp-skill/extension/avalanche.iife.js +5536 -0
- package/lib/mcp-skill/extension/avalanche.iife.js.map +1 -0
- package/lib/mcp-skill/extension/background.js +325 -0
- package/lib/mcp-skill/extension/chippy-page-bridge.js +1953 -0
- package/lib/mcp-skill/extension/content-script.js +190 -0
- package/lib/mcp-skill/extension/devtools-hook-shim.js +85 -0
- package/lib/mcp-skill/extension/early-bootstrap.js +49 -0
- package/lib/mcp-skill/extension/icon-128.png +0 -0
- package/lib/mcp-skill/extension/icon-16.png +0 -0
- package/lib/mcp-skill/extension/icon-32.png +0 -0
- package/lib/mcp-skill/extension/icon-48.png +0 -0
- package/lib/mcp-skill/extension/inspect-react.js +216 -0
- package/lib/mcp-skill/extension/layout-lab.js +1453 -0
- package/lib/mcp-skill/extension/logo.svg +14 -0
- package/lib/mcp-skill/extension/manifest.json +69 -0
- package/lib/mcp-skill/extension/panel-dom.js +90 -0
- package/lib/mcp-skill/extension/panel-settings.js +173 -0
- package/lib/mcp-skill/extension/popup.html +41 -0
- package/lib/mcp-skill/extension/popup.js +80 -0
- package/lib/mcp-skill/extension/probe-descriptor.js +241 -0
- package/lib/mcp-skill/extension/resolve-probes.js +342 -0
- package/lib/mcp-skill/extension/startup-handoff.js +30 -0
- package/lib/mcp-skill/package.json +1 -0
- package/lib/mcp-skill/references/README.md +56 -0
- package/lib/mcp-skill/references/active-stimulus.md +85 -0
- package/lib/mcp-skill/references/avalanche-detector.md +731 -0
- package/lib/mcp-skill/references/bdd-router.md +310 -0
- package/lib/mcp-skill/references/browser-runtime-api.md +193 -0
- package/lib/mcp-skill/references/command-output-formats.md +1085 -0
- package/lib/mcp-skill/references/command-surface.md +183 -0
- package/lib/mcp-skill/references/cynefin.md +99 -0
- package/lib/mcp-skill/references/debug-hook.md +161 -0
- package/lib/mcp-skill/references/fixing-performance.md +490 -0
- package/lib/mcp-skill/references/hook-metrics.md +199 -0
- package/lib/mcp-skill/references/hooks-inspection.md +61 -0
- package/lib/mcp-skill/references/jira-taxonomy.md +81 -0
- package/lib/mcp-skill/references/mcp.md +122 -0
- package/lib/mcp-skill/references/mode-a-injection.md +102 -0
- package/lib/mcp-skill/references/operating-model.md +128 -0
- package/lib/mcp-skill/references/playwright-cli-setup.md +105 -0
- package/lib/mcp-skill/references/playwright-probes.md +205 -0
- package/lib/mcp-skill/references/procedures.md +545 -0
- package/lib/mcp-skill/references/recipes.txt +114 -0
- package/lib/mcp-skill/references/stability-render.md +428 -0
- package/lib/mcp-skill/references/test-mode-playbook.md +194 -0
- package/lib/mcp-skill/references/troubleshooting.md +59 -0
- package/lib/mcp-skill/scripts/avalanche-analyze.cjs +495 -0
- package/lib/mcp-skill/scripts/build-avalanche-command.js +34 -0
- package/lib/mcp-skill/scripts/build-fiber-state-command.js +19 -0
- package/lib/mcp-skill/scripts/chippy-helper-server.js +1768 -0
- package/lib/mcp-skill/scripts/chippy-mcp.cjs +273 -0
- package/lib/mcp-skill/scripts/chippy.sh +1252 -0
- package/lib/mcp-skill/scripts/format-probe-result.js +34 -0
- package/lib/mcp-skill/scripts/helper-access.js +158 -0
- package/lib/mcp-skill/scripts/helper-proxy.js +87 -0
- package/lib/mcp-skill/scripts/page-socket-trust.js +81 -0
- package/lib/mcp-skill/scripts/probe-annotation-channel.js +116 -0
- package/lib/mcp-skill/scripts/search-recipes.js +248 -0
- package/lib/mcp-skill/snippets/README.md +89 -0
- package/lib/mcp-skill/snippets/count-context-consumers.js +40 -0
- package/lib/mcp-skill/snippets/find-context-providers.js +38 -0
- package/lib/mcp-skill/snippets/find-legacy-context.js +47 -0
- package/lib/mcp-skill/snippets/find-prop.js +83 -0
- package/lib/mcp-skill/snippets/hook-metrics-sample.js +69 -0
- package/lib/mcp-skill/snippets/hook-metrics.js +60 -0
- package/lib/mcp-skill/snippets/hook-tracker.js +198 -0
- package/lib/mcp-skill/snippets/stability-nudge.js +101 -0
- package/lib/package.json +1 -0
- package/lib/plugin.js +119 -0
- package/lib/plugin.js.map +7 -0
- package/lib/storybook/avalanche-panel-model.js +79 -0
- package/lib/storybook/brand.jsx +6 -0
- package/lib/storybook/connection-fallback.jsx +47 -0
- package/lib/storybook/constants.js +15 -0
- package/lib/storybook/context-card.jsx +171 -0
- package/lib/storybook/manager-owner.js +42 -0
- package/lib/storybook/manager.jsx +425 -0
- package/lib/storybook/preset.js +7 -0
- package/lib/storybook/preview.js +298 -0
- package/lib/storybook/probe-annotation-editor.jsx +52 -0
- package/lib/storybook/probe-intent.js +23 -0
- package/lib/storybook/setup.js +104 -0
- package/lib/types/avalanche/commit-metrics-adapter.d.ts +76 -0
- package/lib/types/avalanche/commit-stats-indices.d.ts +41 -0
- package/lib/types/avalanche/commit-surface-ownership.d.ts +9 -0
- package/lib/types/avalanche/detector.d.ts +183 -0
- package/lib/types/avalanche/interaction-capture.d.ts +25 -0
- package/lib/types/avalanche/internals.d.ts +189 -0
- package/lib/types/avalanche/report-serializer.d.ts +283 -0
- package/lib/types/avalanche/reporter.d.ts +610 -0
- package/lib/types/chippy-bridge/fiber-source.d.ts +48 -0
- package/lib/types/chippy-bridge/react-renderer.d.ts +74 -0
- package/lib/types/chippy-bridge/recorded-source.d.ts +44 -0
- package/lib/types/chippy-bridge/source-map.d.ts +30 -0
- package/lib/types/debug-render/core.d.ts +78 -0
- package/lib/types/layout-lab/fiber-boundaries.d.ts +51 -0
- package/lib/types/layout-lab/fiber-walk.d.ts +131 -0
- package/lib/types/layout-lab/marker-context.d.ts +94 -0
- package/lib/types/package/avalanche.d.ts +6 -0
- package/lib/types/package/browser.d.ts +10 -0
- package/lib/types/package/plugin.d.ts +15 -0
- package/lib/types/plugins/atl/commit-metrics-adapter.d.ts +65 -0
- package/lib/types/plugins/atl/metrics-slot.d.ts +37 -0
- package/lib/types/plugins/index.d.ts +49 -0
- package/lib/types/plugins/jira/context-provider.d.ts +36 -0
- package/package.json +106 -4
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
(function installChippyPanelDom(global) {
|
|
3
|
+
function nodeKey(node) {
|
|
4
|
+
return node?.nodeType === 1 ? node.getAttribute('data-chippy-key') : null;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function canPatch(current, next) {
|
|
8
|
+
if (!current || !next || current.nodeType !== next.nodeType) return false;
|
|
9
|
+
if (current.nodeType === 1 && current.tagName !== next.tagName) return false;
|
|
10
|
+
const currentKey = nodeKey(current);
|
|
11
|
+
const nextKey = nodeKey(next);
|
|
12
|
+
return currentKey || nextKey ? currentKey === nextKey : true;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function syncAttributes(current, next) {
|
|
16
|
+
Array.from(current.attributes).forEach((attribute) => {
|
|
17
|
+
if (!next.hasAttribute(attribute.name)) current.removeAttribute(attribute.name);
|
|
18
|
+
});
|
|
19
|
+
Array.from(next.attributes).forEach((attribute) => {
|
|
20
|
+
if (current.getAttribute(attribute.name) !== attribute.value) {
|
|
21
|
+
current.setAttribute(attribute.name, attribute.value);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function patchNode(current, next) {
|
|
27
|
+
if (current.nodeType === 3 || current.nodeType === 8) {
|
|
28
|
+
if (current.data !== next.data) current.data = next.data;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (current.nodeType !== 1) return;
|
|
32
|
+
|
|
33
|
+
const tagName = current.tagName;
|
|
34
|
+
const preservesValue = tagName === 'INPUT' || tagName === 'TEXTAREA' || tagName === 'SELECT';
|
|
35
|
+
const value = preservesValue ? current.value : null;
|
|
36
|
+
const checked = tagName === 'INPUT' ? current.checked : null;
|
|
37
|
+
|
|
38
|
+
syncAttributes(current, next);
|
|
39
|
+
patchChildNodes(current, next);
|
|
40
|
+
|
|
41
|
+
// Probe annotations are drafts until Attach is clicked. Rendering new
|
|
42
|
+
// runtime evidence must not overwrite an in-progress value.
|
|
43
|
+
if (preservesValue) current.value = value;
|
|
44
|
+
if (tagName === 'INPUT') current.checked = checked;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function patchChildNodes(currentParent, nextParent) {
|
|
48
|
+
const currentChildren = Array.from(currentParent.childNodes);
|
|
49
|
+
const keyed = new Map(
|
|
50
|
+
currentChildren
|
|
51
|
+
.map((node) => [nodeKey(node), node])
|
|
52
|
+
.filter(([key]) => Boolean(key)),
|
|
53
|
+
);
|
|
54
|
+
const used = new Set();
|
|
55
|
+
let cursor = currentParent.firstChild;
|
|
56
|
+
|
|
57
|
+
Array.from(nextParent.childNodes).forEach((nextChild) => {
|
|
58
|
+
const key = nodeKey(nextChild);
|
|
59
|
+
let current = key ? keyed.get(key) : null;
|
|
60
|
+
|
|
61
|
+
while (cursor && used.has(cursor)) cursor = cursor.nextSibling;
|
|
62
|
+
if (!current && cursor && !nodeKey(cursor) && canPatch(cursor, nextChild)) current = cursor;
|
|
63
|
+
|
|
64
|
+
if (current && canPatch(current, nextChild)) {
|
|
65
|
+
if (current !== cursor) currentParent.insertBefore(current, cursor);
|
|
66
|
+
patchNode(current, nextChild);
|
|
67
|
+
} else {
|
|
68
|
+
current = nextChild.cloneNode(true);
|
|
69
|
+
currentParent.insertBefore(current, cursor);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
used.add(current);
|
|
73
|
+
cursor = current.nextSibling;
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
Array.from(currentParent.childNodes).forEach((child) => {
|
|
77
|
+
if (used.has(child)) return;
|
|
78
|
+
if (child.nodeType === 1 && child.hasAttribute('data-chippy-preserve')) return;
|
|
79
|
+
child.remove();
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function patchChildren(target, html) {
|
|
84
|
+
const template = target.ownerDocument.createElement('template');
|
|
85
|
+
template.innerHTML = html;
|
|
86
|
+
patchChildNodes(target, template.content);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
global.__CHIPPY_PANEL_DOM__ = { patchChildren };
|
|
90
|
+
})(window);
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
(function installResolveProbes(global) {
|
|
3
|
+
const chippy = global.__CHIPPY = global.__CHIPPY || {};
|
|
4
|
+
// Always reinstall — guards caused stale code to win after extension reload.
|
|
5
|
+
|
|
6
|
+
// ─── Source confidence ────────────────────────────────────────────────────
|
|
7
|
+
// In a dev build React <=18 exposes _debugSource; React 19 exposes
|
|
8
|
+
// _debugStack, which the bundled resolver turns into a source location.
|
|
9
|
+
// In a production build neither exists — we only have component function
|
|
10
|
+
// names from fiber.type, which may also be minified.
|
|
11
|
+
//
|
|
12
|
+
// Every resolved probe carries a `confidence` field:
|
|
13
|
+
// "dev" — React development source evidence is present
|
|
14
|
+
// "production" — no _debugSource, component names only (may be minified)
|
|
15
|
+
// "unknown" — could not determine anything useful
|
|
16
|
+
|
|
17
|
+
function sourceConfidence(source, owners) {
|
|
18
|
+
if (source?.fileName) return 'dev';
|
|
19
|
+
if (owners?.some((o) => o?.source?.fileName)) return 'dev';
|
|
20
|
+
return 'production';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function summarizeSource(source) {
|
|
24
|
+
if (!source) return null;
|
|
25
|
+
return {
|
|
26
|
+
fileName: source.fileName || null,
|
|
27
|
+
lineNumber: source.lineNumber || null,
|
|
28
|
+
columnNumber: source.columnNumber || null,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function summarizeChainEntry(entry) {
|
|
33
|
+
if (!entry) return null;
|
|
34
|
+
return {
|
|
35
|
+
name: entry.name || null,
|
|
36
|
+
key: entry.key ?? null,
|
|
37
|
+
source: summarizeSource(entry.source),
|
|
38
|
+
// props from layout-lab getOwnerChain/getReturnComponentChain are already key arrays
|
|
39
|
+
propNames: Array.isArray(entry.props)
|
|
40
|
+
? entry.props.filter((k) => k !== 'children')
|
|
41
|
+
: (entry.props && typeof entry.props === 'object' ? listPropNames(entry.props) : []),
|
|
42
|
+
hookCount: entry.hookCount ?? null,
|
|
43
|
+
hookCountTruncated: entry.hookCountTruncated ?? false,
|
|
44
|
+
hookCountMax: entry.hookCountMax ?? null,
|
|
45
|
+
complexityNote: typeof entry.hookCount === 'number' && entry.hookCount >= 40
|
|
46
|
+
? 'High enough hook count to inspect carefully before changing local logic.'
|
|
47
|
+
: null,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function summarizeProps(props) {
|
|
52
|
+
if (!props || typeof props !== 'object') return {};
|
|
53
|
+
return Object.entries(props)
|
|
54
|
+
.filter(([k]) => !['children', 'style', 'className'].includes(k))
|
|
55
|
+
.reduce((acc, [k, v]) => {
|
|
56
|
+
if (v == null) { acc[k] = v; return acc; }
|
|
57
|
+
if (typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean') {
|
|
58
|
+
acc[k] = v; return acc;
|
|
59
|
+
}
|
|
60
|
+
if (Array.isArray(v)) { acc[k] = `[array:${v.length}]`; return acc; }
|
|
61
|
+
if (typeof v === 'function') { acc[k] = '[function]'; return acc; }
|
|
62
|
+
acc[k] = v?.id || v?.key || v?.name || '[object]';
|
|
63
|
+
return acc;
|
|
64
|
+
}, {});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// List all prop names (excluding children) for a props object — used for compact snapshot
|
|
68
|
+
function listPropNames(props) {
|
|
69
|
+
if (!props || typeof props !== 'object') return [];
|
|
70
|
+
return Object.keys(props).filter((k) => k !== 'children');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// ─── Component stack fallback for production ──────────────────────────────
|
|
74
|
+
// When _debugSource is absent we still try to provide a useful component
|
|
75
|
+
// stack by walking fiber.return. Names may be minified in production.
|
|
76
|
+
|
|
77
|
+
function getComponentStack(fiber) {
|
|
78
|
+
if (!fiber) return [];
|
|
79
|
+
const stack = [];
|
|
80
|
+
let current = fiber.return;
|
|
81
|
+
while (current) {
|
|
82
|
+
const name =
|
|
83
|
+
current.type?.displayName ||
|
|
84
|
+
current.type?.name ||
|
|
85
|
+
current.type?.render?.displayName ||
|
|
86
|
+
current.type?.render?.name ||
|
|
87
|
+
null;
|
|
88
|
+
if (name && typeof current.type !== 'string') {
|
|
89
|
+
stack.push({ name, key: current.key ?? null, source: null });
|
|
90
|
+
}
|
|
91
|
+
current = current.return;
|
|
92
|
+
}
|
|
93
|
+
return stack;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// ─── Full probe summary ───────────────────────────────────────────────────
|
|
97
|
+
|
|
98
|
+
function summarizeProbe(probe) {
|
|
99
|
+
const best = probe?.probe?.best;
|
|
100
|
+
return {
|
|
101
|
+
dom: {
|
|
102
|
+
tag: best?.exact?.domTag,
|
|
103
|
+
text: best?.exact?.domText,
|
|
104
|
+
fiberType: best?.exact?.fiberType,
|
|
105
|
+
source: best?.exact?.source,
|
|
106
|
+
},
|
|
107
|
+
component: {
|
|
108
|
+
name: best?.component?.name,
|
|
109
|
+
key: best?.component?.key ?? null,
|
|
110
|
+
props: best?.component?.props,
|
|
111
|
+
propNames: listPropNames(best?.component?.props),
|
|
112
|
+
hookCount: best?.component?.hookCount ?? null,
|
|
113
|
+
hookCountTruncated: best?.component?.hookCountTruncated ?? false,
|
|
114
|
+
hookCountMax: best?.component?.hookCountMax ?? null,
|
|
115
|
+
complexityNote: typeof best?.component?.hookCount === 'number' && best.component.hookCount >= 40
|
|
116
|
+
? 'High enough hook count to inspect carefully before changing local logic.'
|
|
117
|
+
: null,
|
|
118
|
+
source: best?.component?.source,
|
|
119
|
+
owners: best?.component?.owners,
|
|
120
|
+
parents: best?.component?.parents,
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// ─── Compact probe summary (used by bridge for publishing) ────────────────
|
|
126
|
+
|
|
127
|
+
function compactProbeSummary(probe) {
|
|
128
|
+
const best = probe?.probe?.best;
|
|
129
|
+
|
|
130
|
+
const componentSource = summarizeSource(best?.component?.source);
|
|
131
|
+
const owners = (best?.component?.owners || []).map(summarizeChainEntry);
|
|
132
|
+
const confidence = sourceConfidence(componentSource, owners);
|
|
133
|
+
|
|
134
|
+
// In production, owners from _debugOwner chain are absent.
|
|
135
|
+
// Fall back to the fiber return-chain component stack.
|
|
136
|
+
let resolvedOwners = owners;
|
|
137
|
+
let componentStack = null;
|
|
138
|
+
if (confidence === 'production') {
|
|
139
|
+
// Try to get the raw fiber for fallback stack
|
|
140
|
+
const rawFiber = probe?.probe?.rawFiber || null;
|
|
141
|
+
componentStack = getComponentStack(rawFiber);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Matched CSS rules — rules from all sheets whose selector matches the target element
|
|
145
|
+
const targetEl = probe?.probe?._targetEl || null;
|
|
146
|
+
const inspectedTarget = targetEl ? chippy.inspectReact?.inspectNode?.(targetEl) : null;
|
|
147
|
+
const nearestTestId = inspectedTarget?.nearestTestIdParent?.testId || null;
|
|
148
|
+
const matchedStyles = [];
|
|
149
|
+
if (targetEl) {
|
|
150
|
+
try {
|
|
151
|
+
for (const sheet of document.styleSheets) {
|
|
152
|
+
let rules;
|
|
153
|
+
try { rules = sheet.cssRules; } catch { continue; }
|
|
154
|
+
for (const rule of rules) {
|
|
155
|
+
if (rule instanceof CSSStyleRule) {
|
|
156
|
+
try {
|
|
157
|
+
if (targetEl.matches(rule.selectorText)) {
|
|
158
|
+
matchedStyles.push({
|
|
159
|
+
selector: rule.selectorText,
|
|
160
|
+
declarations: rule.style.cssText,
|
|
161
|
+
source: sheet.href || 'inline',
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
} catch { /* invalid selector — skip */ }
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
} catch { /* sheet access failed */ }
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// DOM parent chain — walk up to 10 parentElement levels from the target element
|
|
172
|
+
const domParents = [];
|
|
173
|
+
if (targetEl) {
|
|
174
|
+
let el = targetEl.parentElement;
|
|
175
|
+
while (el && domParents.length < 10) {
|
|
176
|
+
const cls = el.className && typeof el.className === 'string'
|
|
177
|
+
? el.className.trim().split(/\s+/).slice(0, 3).join(' ')
|
|
178
|
+
: null;
|
|
179
|
+
domParents.push({
|
|
180
|
+
tag: el.tagName?.toLowerCase() || null,
|
|
181
|
+
id: el.id || null,
|
|
182
|
+
className: cls || null,
|
|
183
|
+
});
|
|
184
|
+
el = el.parentElement;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return {
|
|
189
|
+
nearestTestId,
|
|
190
|
+
confidence,
|
|
191
|
+
dom: {
|
|
192
|
+
tag: best?.exact?.domTag || null,
|
|
193
|
+
text: (best?.exact?.domText || '').slice(0, 80),
|
|
194
|
+
fiberType: best?.exact?.fiberType || null,
|
|
195
|
+
source: summarizeSource(best?.exact?.source),
|
|
196
|
+
parents: domParents,
|
|
197
|
+
matchedStyles,
|
|
198
|
+
},
|
|
199
|
+
component: {
|
|
200
|
+
name: best?.component?.name || null,
|
|
201
|
+
key: best?.component?.key ?? null,
|
|
202
|
+
propNames: listPropNames(best?.component?.props),
|
|
203
|
+
props: summarizeProps(best?.component?.props),
|
|
204
|
+
hookCount: best?.component?.hookCount ?? null,
|
|
205
|
+
hookCountTruncated: best?.component?.hookCountTruncated ?? false,
|
|
206
|
+
hookCountMax: best?.component?.hookCountMax ?? null,
|
|
207
|
+
complexityNote: typeof best?.component?.hookCount === 'number' && best.component.hookCount >= 40
|
|
208
|
+
? 'High enough hook count to inspect carefully before changing local logic.'
|
|
209
|
+
: null,
|
|
210
|
+
source: componentSource,
|
|
211
|
+
owners: resolvedOwners,
|
|
212
|
+
// In production: source-free stack from fiber.return walk
|
|
213
|
+
componentStack: confidence !== 'dev' ? componentStack : null,
|
|
214
|
+
parents: (best?.component?.parents || []).map(summarizeChainEntry),
|
|
215
|
+
},
|
|
216
|
+
// Human-readable note about what is and isn't available
|
|
217
|
+
note: confidence === 'dev'
|
|
218
|
+
? null
|
|
219
|
+
: confidence === 'production'
|
|
220
|
+
? 'Production build: no React development source metadata is available. Component names may be minified. Source locations are not reliable. Use component stack and names only.'
|
|
221
|
+
: 'Could not determine build mode. Probe data may be incomplete.',
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// ─── Cross-source correlation hint ───────────────────────────────────────
|
|
226
|
+
// When one probe is on a dev page and another is on a production page
|
|
227
|
+
// pointing at "around the same component", the agent can use this to
|
|
228
|
+
// try to match names across the two.
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
function componentIdentity(entry) {
|
|
232
|
+
if (!entry) return null;
|
|
233
|
+
const src = entry.source || null;
|
|
234
|
+
const srcKey = src && src.fileName ? `${src.fileName}:${src.lineNumber || 0}:${src.columnNumber || 0}` : '';
|
|
235
|
+
return `${entry.name || ''}|${entry.key ?? ''}|${srcKey}`;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function ancestryForSummary(summary) {
|
|
239
|
+
if (!summary?.component) return [];
|
|
240
|
+
const out = [];
|
|
241
|
+
out.push({
|
|
242
|
+
name: summary.component.name || null,
|
|
243
|
+
key: summary.component.key ?? null,
|
|
244
|
+
source: summary.component.source || null,
|
|
245
|
+
propNames: summary.component.propNames || [],
|
|
246
|
+
hookCount: summary.component.hookCount ?? null,
|
|
247
|
+
hookCountTruncated: summary.component.hookCountTruncated ?? false,
|
|
248
|
+
hookCountMax: summary.component.hookCountMax ?? null,
|
|
249
|
+
complexityNote: summary.component.complexityNote || null,
|
|
250
|
+
});
|
|
251
|
+
for (const parent of summary.component.parents || []) out.push(parent);
|
|
252
|
+
return out.filter(Boolean);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function findCommonParent(summaries) {
|
|
256
|
+
const ids = Object.keys(summaries).filter((id) => !id.startsWith('__') && summaries[id]?.component);
|
|
257
|
+
if (ids.length < 2) return null;
|
|
258
|
+
const chains = ids.map((id) => ancestryForSummary(summaries[id]));
|
|
259
|
+
if (chains.some((c) => c.length === 0)) return null;
|
|
260
|
+
const otherSets = chains.slice(1).map((chain) => new Set(chain.map(componentIdentity).filter(Boolean)));
|
|
261
|
+
for (const entry of chains[0]) {
|
|
262
|
+
const id = componentIdentity(entry);
|
|
263
|
+
if (!id) continue;
|
|
264
|
+
if (otherSets.every((set) => set.has(id))) {
|
|
265
|
+
return {
|
|
266
|
+
confidence: 'dev',
|
|
267
|
+
dom: null,
|
|
268
|
+
component: {
|
|
269
|
+
name: entry.name || null,
|
|
270
|
+
key: entry.key ?? null,
|
|
271
|
+
propNames: entry.propNames || [],
|
|
272
|
+
props: {},
|
|
273
|
+
hookCount: entry.hookCount ?? null,
|
|
274
|
+
hookCountTruncated: entry.hookCountTruncated ?? false,
|
|
275
|
+
hookCountMax: entry.hookCountMax ?? null,
|
|
276
|
+
complexityNote: entry.complexityNote || null,
|
|
277
|
+
source: entry.source || null,
|
|
278
|
+
owners: [],
|
|
279
|
+
componentStack: null,
|
|
280
|
+
parents: [],
|
|
281
|
+
},
|
|
282
|
+
note: `Nearest common parent for probes ${ids.join(', ')}.`,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function correlatePairs(summaries) {
|
|
290
|
+
const ids = Object.keys(summaries);
|
|
291
|
+
const devProbes = ids.filter((id) => summaries[id]?.confidence === 'dev');
|
|
292
|
+
const prodProbes = ids.filter((id) => summaries[id]?.confidence === 'production');
|
|
293
|
+
if (devProbes.length === 0 || prodProbes.length === 0) return null;
|
|
294
|
+
|
|
295
|
+
const hints = [];
|
|
296
|
+
for (const devId of devProbes) {
|
|
297
|
+
for (const prodId of prodProbes) {
|
|
298
|
+
const devName = summaries[devId]?.component?.name;
|
|
299
|
+
const prodName = summaries[prodId]?.component?.name;
|
|
300
|
+
hints.push({
|
|
301
|
+
devProbe: devId,
|
|
302
|
+
productionProbe: prodId,
|
|
303
|
+
devComponentName: devName || null,
|
|
304
|
+
productionComponentName: prodName || null,
|
|
305
|
+
note: devName && prodName && devName === prodName
|
|
306
|
+
? `Component names match ("${devName}") — likely the same component.`
|
|
307
|
+
: devName && prodName
|
|
308
|
+
? `Component names differ ("${devName}" vs "${prodName}") — may still be the same component if production is minified. Check component stack for structural similarity.`
|
|
309
|
+
: 'Could not compare — one or both probes have no component name.',
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return hints.length > 0 ? hints : null;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// ─── Public API ───────────────────────────────────────────────────────────
|
|
317
|
+
|
|
318
|
+
function resolveProbes(...ids) {
|
|
319
|
+
const result = {};
|
|
320
|
+
for (const id of ids) {
|
|
321
|
+
const probe = chippy.layoutLab?.getMarkerProbe(id);
|
|
322
|
+
result[id] = probe ? summarizeProbe(probe) : null;
|
|
323
|
+
}
|
|
324
|
+
return result;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function resolveProbesCompact(...ids) {
|
|
328
|
+
const result = {};
|
|
329
|
+
for (const id of ids) {
|
|
330
|
+
const probe = chippy.layoutLab?.getMarkerProbe(id);
|
|
331
|
+
result[id] = probe ? compactProbeSummary(probe) : null;
|
|
332
|
+
}
|
|
333
|
+
const crossSourceHints = correlatePairs(result);
|
|
334
|
+
if (crossSourceHints) result.__crossSourceHints = crossSourceHints;
|
|
335
|
+
const commonParent = findCommonParent(result);
|
|
336
|
+
if (commonParent) result.__commonParent = commonParent;
|
|
337
|
+
return result;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
chippy.resolveProbes = resolveProbes;
|
|
341
|
+
chippy.resolveProbesCompact = resolveProbesCompact;
|
|
342
|
+
})(window);
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright (c) 2026 Atlassian US., Inc.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|