mushi-mushi 1.40.1 → 1.41.1
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/README.md +3 -3
- package/dist/angular.d.cts +2 -1
- package/dist/angular.d.ts +2 -1
- package/dist/bin.js +1 -1
- package/dist/eslint.cjs +214 -2
- package/dist/eslint.js +7 -1739
- package/dist/react.d.cts +2 -1
- package/dist/react.d.ts +2 -1
- package/dist/svelte.d.cts +2 -1
- package/dist/svelte.d.ts +2 -1
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# Mushi Mushi
|
|
4
4
|
|
|
5
|
-
> **
|
|
5
|
+
> **The bug button for apps built with AI.**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A user taps it; you get the cause in plain English with the file and line, and a fix prompt in your editor. Open source.
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npx mushi-mushi
|
|
@@ -34,7 +34,7 @@ Run it in your app's folder. No terminal? [Use Lovable or Bolt instead](https://
|
|
|
34
34
|
1. **You sign in through your browser.** The command opens a page. You approve it, and Mushi Mushi makes your free project and key. There is nothing to copy.
|
|
35
35
|
2. **It installs Mushi Mushi and shows you a few lines of code.** Add them to your app (or ask your AI editor to). They show a small report button.
|
|
36
36
|
3. **Your users tap the button when something is wrong.** They write one sentence. Mushi Mushi adds a screenshot and what the app was doing.
|
|
37
|
-
4. **You get the cause in plain English, and a fix your AI editor can apply.** Open the report in the [console](https://kensaur.us
|
|
37
|
+
4. **You get the cause in plain English, and a fix your AI editor can apply.** Open the report in the [console](https://mushi.kensaur.us), or ask your editor for it.
|
|
38
38
|
|
|
39
39
|
The setup adds `mushi-mushi` to your `package.json` and writes your two settings to `.env.local`. It doesn't change your app's code (for a plain JavaScript app it offers to, and asks first). It warns you if `.env.local` is not in `.gitignore`. To see this list for your own app first, run `npx mushi-mushi --dry-run`: it changes nothing.
|
|
40
40
|
|
package/dist/angular.d.cts
CHANGED
|
@@ -92,4 +92,5 @@ declare function provideMushi(config: MushiConfig): MushiEnvironmentProviders;
|
|
|
92
92
|
*/
|
|
93
93
|
declare function provideMushiAngular(config: MushiConfig): Provider[];
|
|
94
94
|
|
|
95
|
-
export { MUSHI_CONFIG,
|
|
95
|
+
export { MUSHI_CONFIG, MushiErrorHandler, MushiService, provideMushi, provideMushiAngular };
|
|
96
|
+
export type { MushiEnvironmentProviders };
|
package/dist/angular.d.ts
CHANGED
|
@@ -92,4 +92,5 @@ declare function provideMushi(config: MushiConfig): MushiEnvironmentProviders;
|
|
|
92
92
|
*/
|
|
93
93
|
declare function provideMushiAngular(config: MushiConfig): Provider[];
|
|
94
94
|
|
|
95
|
-
export { MUSHI_CONFIG,
|
|
95
|
+
export { MUSHI_CONFIG, MushiErrorHandler, MushiService, provideMushi, provideMushiAngular };
|
|
96
|
+
export type { MushiEnvironmentProviders };
|
package/dist/bin.js
CHANGED
package/dist/eslint.cjs
CHANGED
|
@@ -1690,6 +1690,212 @@ var rule17 = {
|
|
|
1690
1690
|
}
|
|
1691
1691
|
};
|
|
1692
1692
|
var no_allowlist_jsx_textnode_default = rule17;
|
|
1693
|
+
var INLINE_TAGS = /* @__PURE__ */ new Set(["span", "code", "kbd", "small", "strong", "em", "abbr", "time", "mark"]);
|
|
1694
|
+
var TONE_HELPER = /^(?:status|runStatus|severity|prState|confidence)ChipTone$/;
|
|
1695
|
+
var TONE_MAPS = /* @__PURE__ */ new Set(["CHIP_TONE", "STATUS_SOFT"]);
|
|
1696
|
+
var PAGE_TONE_MAP = /^[A-Z][A-Z0-9_]*_(?:TONE|BADGE|CHIP|PILL|CLS|STYLE)S?$/;
|
|
1697
|
+
var TONE_VAR = /tone|chip|pill|badge|cls/i;
|
|
1698
|
+
var LABEL_SIZE_ANY = /(?:^|\s)text-(?:xs|2xs|3xs)(?=\s|$)/;
|
|
1699
|
+
var ROUNDED = /(?:^|\s)rounded(?:-[a-z0-9]+)?(?=\s|$)/;
|
|
1700
|
+
var PADDED = /(?:^|\s)px-/;
|
|
1701
|
+
var TONES = "ok|warn|danger|info|accent|brand|lime|rose|sev-medium";
|
|
1702
|
+
var LITERAL_TINT = new RegExp(
|
|
1703
|
+
String.raw`(?:^|\s)bg-(?:(?:${TONES})-(?:muted|subtle)|st-[a-z]+-soft|(?:${TONES})\/[1-6]?\d(?:\.\d+)?)(?:\/[\d.]+)?(?=\s|$)`
|
|
1704
|
+
);
|
|
1705
|
+
var TEXT_COLOUR = /(?:^|\s)text-(?!(?:2xs|3xs|xs|sm|base|lg|xl|\dxl|left|right|center|justify|start|end|wrap|nowrap|balance|pretty|ellipsis|clip)(?:\s|$))[a-z][\w-]*(?:\/[\d.]+)?(?=\s|$)/;
|
|
1706
|
+
var LABEL_SIZE = /(?:^|\s)text-(?:2xs|3xs)(?=\s|$)/;
|
|
1707
|
+
var SIZE_TOKEN = /^size-\d+(?:\.\d+)?$/;
|
|
1708
|
+
var W_TOKEN = /^w-\d/;
|
|
1709
|
+
var H_TOKEN = /^h-\d/;
|
|
1710
|
+
function isWell(classes) {
|
|
1711
|
+
const tokens = classes.split(/\s+/).filter(Boolean);
|
|
1712
|
+
if (tokens.some((t) => SIZE_TOKEN.test(t))) return true;
|
|
1713
|
+
return tokens.some((t) => W_TOKEN.test(t)) && tokens.some((t) => H_TOKEN.test(t));
|
|
1714
|
+
}
|
|
1715
|
+
function walk(root, visit) {
|
|
1716
|
+
const stack = [root];
|
|
1717
|
+
while (stack.length) {
|
|
1718
|
+
const n = stack.pop();
|
|
1719
|
+
if (visit(n) === true) return;
|
|
1720
|
+
for (const [key, value] of Object.entries(n)) {
|
|
1721
|
+
if (key === "parent" || key === "loc" || key === "range") continue;
|
|
1722
|
+
if (Array.isArray(value)) {
|
|
1723
|
+
for (const v of value) if (v && typeof v === "object" && "type" in v) stack.push(v);
|
|
1724
|
+
} else if (value && typeof value === "object" && "type" in value) {
|
|
1725
|
+
stack.push(value);
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
function looksUpPageToneMap(expr) {
|
|
1731
|
+
let hit = false;
|
|
1732
|
+
walk(expr, (n) => {
|
|
1733
|
+
if (n.type === "MemberExpression") {
|
|
1734
|
+
const m = n;
|
|
1735
|
+
if (m.computed && m.object.type === "Identifier" && m.object.name && PAGE_TONE_MAP.test(m.object.name) && !TONE_MAPS.has(m.object.name)) hit = true;
|
|
1736
|
+
}
|
|
1737
|
+
return hit;
|
|
1738
|
+
});
|
|
1739
|
+
return hit;
|
|
1740
|
+
}
|
|
1741
|
+
function interpolatesToneVariable(expr) {
|
|
1742
|
+
let hit = false;
|
|
1743
|
+
const named = (n) => n.type === "Identifier" && !!n.name && n.name !== "className" && TONE_VAR.test(n.name);
|
|
1744
|
+
walk(expr, (n) => {
|
|
1745
|
+
if (n.type !== "TemplateLiteral") return false;
|
|
1746
|
+
for (const e of n.expressions) {
|
|
1747
|
+
if (named(e)) hit = true;
|
|
1748
|
+
else if (e.type === "MemberExpression") {
|
|
1749
|
+
const m = e;
|
|
1750
|
+
if (m.object.type === "Identifier" && m.object.name && TONE_MAPS.has(m.object.name)) continue;
|
|
1751
|
+
if (!m.computed && named(m.property) || named(m.object)) hit = true;
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
return hit;
|
|
1755
|
+
});
|
|
1756
|
+
return hit;
|
|
1757
|
+
}
|
|
1758
|
+
function paintsToneRecipe(expr) {
|
|
1759
|
+
let hit = false;
|
|
1760
|
+
walk(expr, (n) => {
|
|
1761
|
+
if (n.type === "MemberExpression") {
|
|
1762
|
+
const m = n;
|
|
1763
|
+
const neutral = m.object.name === "CHIP_TONE" && !m.computed && m.property.name === "neutral";
|
|
1764
|
+
if (m.object.type === "Identifier" && m.object.name && TONE_MAPS.has(m.object.name) && !neutral) hit = true;
|
|
1765
|
+
} else if (n.type === "CallExpression") {
|
|
1766
|
+
const callee = n.callee;
|
|
1767
|
+
if (callee.type === "Identifier" && callee.name && TONE_HELPER.test(callee.name)) hit = true;
|
|
1768
|
+
}
|
|
1769
|
+
return hit;
|
|
1770
|
+
});
|
|
1771
|
+
return hit;
|
|
1772
|
+
}
|
|
1773
|
+
function staticClasses(expr) {
|
|
1774
|
+
const parts = [];
|
|
1775
|
+
walk(expr, (n) => {
|
|
1776
|
+
if (n.type === "Literal" && typeof n.value === "string") parts.push(n.value);
|
|
1777
|
+
else if (n.type === "TemplateElement") parts.push(n.value.raw);
|
|
1778
|
+
});
|
|
1779
|
+
return parts.join(" ").split(/\s+/).filter((c) => c && !/^[a-z0-9-]+:/.test(c) && !/^\[/.test(c)).join(" ");
|
|
1780
|
+
}
|
|
1781
|
+
var rule18 = {
|
|
1782
|
+
meta: {
|
|
1783
|
+
type: "suggestion",
|
|
1784
|
+
docs: {
|
|
1785
|
+
description: "Disallow hand-rolled tinted label chips; use Badge, SeverityPill, StatusPill, CountBadge or ScoreBadge (ADR 0077)."
|
|
1786
|
+
},
|
|
1787
|
+
messages: {
|
|
1788
|
+
adHocTintedChip: "A label is <Badge tone>, <SeverityPill>, <StatusPill>, <CountBadge> or <ScoreBadge> (ADR 0077), not a tinted <{{tag}}>: a tint hugging its text reads as a highlighter mark."
|
|
1789
|
+
},
|
|
1790
|
+
schema: []
|
|
1791
|
+
},
|
|
1792
|
+
create(context) {
|
|
1793
|
+
const filename = (context.filename ?? "").replace(/\\/g, "/");
|
|
1794
|
+
if (!filename.includes("apps/admin/src")) return {};
|
|
1795
|
+
const source = context.sourceCode;
|
|
1796
|
+
function allowlisted(node) {
|
|
1797
|
+
const line = (node.loc?.start.line ?? 1) - 1;
|
|
1798
|
+
const lines = source.lines;
|
|
1799
|
+
return [lines[line] ?? "", lines[line - 1] ?? ""].some((l) => /mushi-mushi-allowlist:/.test(l));
|
|
1800
|
+
}
|
|
1801
|
+
return {
|
|
1802
|
+
JSXOpeningElement(node) {
|
|
1803
|
+
const el = node;
|
|
1804
|
+
if (el.name.type !== "JSXIdentifier" || !el.name.name || !INLINE_TAGS.has(el.name.name)) return;
|
|
1805
|
+
const attr = el.attributes.find((a) => a.type === "JSXAttribute" && a.name?.name === "className");
|
|
1806
|
+
if (!attr?.value) return;
|
|
1807
|
+
const expr = attr.value.type === "JSXExpressionContainer" ? attr.value.expression : attr.value;
|
|
1808
|
+
const classes = ` ${staticClasses(expr)} `;
|
|
1809
|
+
if (isWell(classes)) return;
|
|
1810
|
+
const chipShaped = ROUNDED.test(classes) && PADDED.test(classes);
|
|
1811
|
+
const recipe = paintsToneRecipe(expr) || looksUpPageToneMap(expr) && chipShaped || interpolatesToneVariable(expr) && chipShaped && LABEL_SIZE_ANY.test(classes);
|
|
1812
|
+
const literal = LITERAL_TINT.test(classes) && TEXT_COLOUR.test(classes) && LABEL_SIZE.test(classes);
|
|
1813
|
+
if (!recipe && !literal) return;
|
|
1814
|
+
if (allowlisted(node)) return;
|
|
1815
|
+
context.report({ node, messageId: "adHocTintedChip", data: { tag: el.name.name } });
|
|
1816
|
+
}
|
|
1817
|
+
};
|
|
1818
|
+
}
|
|
1819
|
+
};
|
|
1820
|
+
var no_ad_hoc_tinted_chip_default = rule18;
|
|
1821
|
+
var BLOCK_TAGS = "div|section|article|li|ul|ol|aside|details|figure|header|footer|nav|form|fieldset";
|
|
1822
|
+
var BLOCK_OPEN = new RegExp(`<(${BLOCK_TAGS})\\b((?:[^>"'{}/]|\\/(?!>)|"[^"]*"|'[^']*'|\\{(?:[^{}]|\\{[^{}]*\\})*\\})*)\\/?>`, "g");
|
|
1823
|
+
var LARGE_RADIUS = /(^|[\s:"'`{])rounded-(md|lg|xl|2xl|3xl|card)(\s|$|["'`}])/;
|
|
1824
|
+
var ALL_ROUND_BORDER = /(^|\s|["'`])border(\s|$|["'`])/;
|
|
1825
|
+
var TONE_EDGE = /border-(warn|danger|info|ok|brand|accent)|border-dashed|data-keep-frame/;
|
|
1826
|
+
function isExemptFile(path) {
|
|
1827
|
+
const p = path.replace(/\\/g, "/");
|
|
1828
|
+
return /\/components\/ui\//.test(p) || /\.test\.tsx?$/.test(p) || /\/design-system\//.test(p) || /(Modal|Dialog|Drawer|Popover|Palette|Toast|Tooltip|Sheet|Menu)\.tsx$/.test(p);
|
|
1829
|
+
}
|
|
1830
|
+
function classNameValue(attrs) {
|
|
1831
|
+
const key = "className=";
|
|
1832
|
+
const lastBrace = attrs.lastIndexOf("}");
|
|
1833
|
+
const unclosed = /* @__PURE__ */ new Set();
|
|
1834
|
+
for (let i = attrs.indexOf(key); i >= 0; i = attrs.indexOf(key, i + 1)) {
|
|
1835
|
+
const start = i + key.length;
|
|
1836
|
+
const open = attrs[start] ?? "";
|
|
1837
|
+
let end = -1;
|
|
1838
|
+
if (open === "{") end = lastBrace;
|
|
1839
|
+
else if ((open === '"' || open === "'") && !unclosed.has(open)) {
|
|
1840
|
+
end = attrs.indexOf(open, start + 1);
|
|
1841
|
+
if (end < 0) unclosed.add(open);
|
|
1842
|
+
}
|
|
1843
|
+
if (end > start) return attrs.slice(start, end + 1);
|
|
1844
|
+
}
|
|
1845
|
+
return void 0;
|
|
1846
|
+
}
|
|
1847
|
+
function findLayoutBoxes(source) {
|
|
1848
|
+
const hits = [];
|
|
1849
|
+
for (const m of source.matchAll(BLOCK_OPEN)) {
|
|
1850
|
+
const attrs = m[2] ?? "";
|
|
1851
|
+
const cls = classNameValue(attrs);
|
|
1852
|
+
if (!cls) continue;
|
|
1853
|
+
if (!LARGE_RADIUS.test(cls) || !ALL_ROUND_BORDER.test(cls) || TONE_EDGE.test(attrs)) continue;
|
|
1854
|
+
hits.push(m.index ?? 0);
|
|
1855
|
+
}
|
|
1856
|
+
return hits;
|
|
1857
|
+
}
|
|
1858
|
+
var SCOPE = "apps/admin/src/";
|
|
1859
|
+
var rule19 = {
|
|
1860
|
+
meta: {
|
|
1861
|
+
type: "suggestion",
|
|
1862
|
+
docs: {
|
|
1863
|
+
description: "No new rounded bordered layout boxes in the Mushi console: use a flat <Card>/<Section>, a hairline, or a tone <Callout> (ADR 0099)."
|
|
1864
|
+
},
|
|
1865
|
+
messages: {
|
|
1866
|
+
box: "Rounded bordered box: this file has {{count}}, its ceiling is {{max}}. Use <Card> or <Section> (flat, ruled), a hairline (border-t), or a tone <Callout> (ADR 0099)."
|
|
1867
|
+
},
|
|
1868
|
+
schema: [
|
|
1869
|
+
{
|
|
1870
|
+
type: "object",
|
|
1871
|
+
properties: {
|
|
1872
|
+
baseline: { type: "object", additionalProperties: { type: "integer", minimum: 0 } }
|
|
1873
|
+
},
|
|
1874
|
+
additionalProperties: false
|
|
1875
|
+
}
|
|
1876
|
+
]
|
|
1877
|
+
},
|
|
1878
|
+
create(context) {
|
|
1879
|
+
const filename = (context.filename ?? "").replace(/\\/g, "/");
|
|
1880
|
+
const at = filename.indexOf(SCOPE);
|
|
1881
|
+
if (at < 0 || !filename.endsWith(".tsx") || isExemptFile(filename)) return {};
|
|
1882
|
+
const rel = filename.slice(at + SCOPE.length);
|
|
1883
|
+
const baseline = (context.options[0] ?? {}).baseline ?? {};
|
|
1884
|
+
const max = baseline[rel] ?? 0;
|
|
1885
|
+
return {
|
|
1886
|
+
"Program:exit"() {
|
|
1887
|
+
const sc = context.sourceCode;
|
|
1888
|
+
const hits = findLayoutBoxes(sc.text);
|
|
1889
|
+
if (hits.length <= max) return;
|
|
1890
|
+
for (const index of hits) {
|
|
1891
|
+
const start = sc.getLocFromIndex(index);
|
|
1892
|
+
context.report({ loc: { start, end: { line: start.line, column: start.column + 1 } }, messageId: "box", data: { count: String(hits.length), max: String(max) } });
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
};
|
|
1896
|
+
}
|
|
1897
|
+
};
|
|
1898
|
+
var no_layout_box_default = rule19;
|
|
1693
1899
|
var PLUGIN_NAME = "mushi-mushi";
|
|
1694
1900
|
var rules = {
|
|
1695
1901
|
"no-dead-handler": no_dead_handler_default,
|
|
@@ -1710,7 +1916,9 @@ var rules = {
|
|
|
1710
1916
|
"no-page-root-padding": no_page_root_padding_default,
|
|
1711
1917
|
"no-arbitrary-length-value": no_arbitrary_length_value_default,
|
|
1712
1918
|
"prefer-card-primitive": prefer_card_primitive_default,
|
|
1713
|
-
"no-allowlist-jsx-textnode": no_allowlist_jsx_textnode_default
|
|
1919
|
+
"no-allowlist-jsx-textnode": no_allowlist_jsx_textnode_default,
|
|
1920
|
+
"no-ad-hoc-tinted-chip": no_ad_hoc_tinted_chip_default,
|
|
1921
|
+
"no-layout-box": no_layout_box_default
|
|
1714
1922
|
};
|
|
1715
1923
|
var recommendedRules = {
|
|
1716
1924
|
[`${PLUGIN_NAME}/no-dead-handler`]: "error",
|
|
@@ -1737,7 +1945,11 @@ var internalRules = {
|
|
|
1737
1945
|
[`${PLUGIN_NAME}/no-page-root-padding`]: "error",
|
|
1738
1946
|
[`${PLUGIN_NAME}/no-arbitrary-length-value`]: "error",
|
|
1739
1947
|
[`${PLUGIN_NAME}/prefer-card-primitive`]: "error",
|
|
1740
|
-
[`${PLUGIN_NAME}/no-allowlist-jsx-textnode`]: "error"
|
|
1948
|
+
[`${PLUGIN_NAME}/no-allowlist-jsx-textnode`]: "error",
|
|
1949
|
+
// A label is a Badge / SeverityPill / StatusPill / CountBadge, never a tinted span (ADR 0077).
|
|
1950
|
+
[`${PLUGIN_NAME}/no-ad-hoc-tinted-chip`]: "error",
|
|
1951
|
+
// The console is flat and ruled (ADR 0099); the console's config passes its per-file baseline.
|
|
1952
|
+
[`${PLUGIN_NAME}/no-layout-box`]: "warn"
|
|
1741
1953
|
};
|
|
1742
1954
|
var plugin = {
|
|
1743
1955
|
meta: { name: "eslint-plugin-mushi-mushi", version: "0.1.0" },
|