@ensi-platform/admin-ui 0.8.1 → 0.8.4
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/bin/ai.js +8682 -0
- package/dist/provider/Component.d.ts +3 -2
- package/dist/provider/Component.d.ts.map +1 -1
- package/dist/provider/index.js +50 -53
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/types.d.ts +8 -2
- package/dist/provider/types.d.ts.map +1 -1
- package/docs/README.md +2 -2
- package/docs/ai.md +9 -9
- package/package.json +8 -8
- package/src/docs/ai/Description.md +9 -9
- package/src/provider/docs/Description.md +2 -1
- package/src/provider/types.ts +10 -2
- package/scripts/consumer-root.ts +0 -66
- package/scripts/sync-agents-consumer.ts +0 -81
- package/scripts/sync-consumer.ts +0 -31
- package/scripts/sync-skill-consumer.ts +0 -57
- /package/{docs/skills → ai/skills/admin-ui}/SKILL.md +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ElementType } from 'react';
|
|
2
|
+
import { TAdminUiProviderProps } from './types';
|
|
3
|
+
export declare const AdminUiProvider: (<P extends ElementType = "div">({ children, direction, locale, labels: labelsProp, linkComponent, className, ...props }: TAdminUiProviderProps<P>) => import("react").JSX.Element) & {
|
|
3
4
|
displayName?: string;
|
|
4
5
|
};
|
|
5
6
|
//# sourceMappingURL=Component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../../../src/provider/Component.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../../../src/provider/Component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0C,KAAK,WAAW,EAAY,MAAM,OAAO,CAAC;AAU3F,OAAO,EAAyB,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAC;AA6D5E,eAAO,MAAM,eAAe,IACvB,CAAC,SAAS,WAAW,mGAQnB,qBAAqB,CAAC,CAAC,CAAC;;CAkB9B,CAAC"}
|
package/dist/provider/index.js
CHANGED
|
@@ -1,73 +1,70 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import { UNSAFE_PortalProvider as
|
|
5
|
-
import { useLocale as
|
|
6
|
-
import { s as
|
|
7
|
-
import { typographyStyles as
|
|
8
|
-
import { A as
|
|
9
|
-
import { a as
|
|
10
|
-
import '../assets/index3.css';const
|
|
11
|
-
root:
|
|
12
|
-
},
|
|
13
|
-
({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const { direction: c } = x(), e = t ?? c, [d, f] = y(null), p = (a) => {
|
|
22
|
-
if (f(a), typeof o == "function") {
|
|
23
|
-
o(a);
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as x, useRef as L, useCallback as P, useMemo as d } from "react";
|
|
3
|
+
import h from "classnames";
|
|
4
|
+
import { UNSAFE_PortalProvider as U } from "react-aria";
|
|
5
|
+
import { useLocale as _, I18nProvider as E } from "react-aria-components";
|
|
6
|
+
import { s as p } from "../index-h8z54aFR.js";
|
|
7
|
+
import { typographyStyles as S } from "../typography/index.js";
|
|
8
|
+
import { A as g, d as C } from "../hooks-BlX5Y4Zt.js";
|
|
9
|
+
import { a as J, u as K, b as O, c as Q } from "../hooks-BlX5Y4Zt.js";
|
|
10
|
+
import '../assets/index3.css';const D = "aub_styles-module_root_d7401", M = {
|
|
11
|
+
root: D
|
|
12
|
+
}, N = p(
|
|
13
|
+
({ as: n, children: c, className: o, direction: e, value: t, ref: s, ...u }) => {
|
|
14
|
+
const a = n ?? "div", { direction: A } = _(), l = e ?? A, [R, b] = x(null), f = L(s);
|
|
15
|
+
f.current = s;
|
|
16
|
+
const y = P((m) => {
|
|
17
|
+
b(m);
|
|
18
|
+
const { current: i } = f;
|
|
19
|
+
if (typeof i == "function") {
|
|
20
|
+
i(m);
|
|
24
21
|
return;
|
|
25
22
|
}
|
|
26
|
-
|
|
27
|
-
},
|
|
23
|
+
i && (i.current = m);
|
|
24
|
+
}, []), v = d(
|
|
28
25
|
() => ({
|
|
29
|
-
...
|
|
30
|
-
direction:
|
|
26
|
+
...t,
|
|
27
|
+
direction: l
|
|
31
28
|
}),
|
|
32
|
-
[
|
|
29
|
+
[t, l]
|
|
33
30
|
);
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
|
|
31
|
+
return /* @__PURE__ */ r(g.Provider, { value: v, children: /* @__PURE__ */ r(U, { getContainer: () => R, children: /* @__PURE__ */ r(
|
|
32
|
+
a,
|
|
36
33
|
{
|
|
37
34
|
...u,
|
|
38
|
-
ref:
|
|
39
|
-
className:
|
|
40
|
-
dir:
|
|
41
|
-
children:
|
|
35
|
+
ref: y,
|
|
36
|
+
className: h(M.root, S.bodyM, o),
|
|
37
|
+
dir: l,
|
|
38
|
+
children: c
|
|
42
39
|
}
|
|
43
40
|
) }) });
|
|
44
41
|
}
|
|
45
|
-
),
|
|
42
|
+
), B = p(
|
|
46
43
|
({
|
|
47
|
-
children:
|
|
48
|
-
direction:
|
|
49
|
-
locale:
|
|
50
|
-
labels:
|
|
51
|
-
linkComponent:
|
|
52
|
-
className:
|
|
53
|
-
...
|
|
44
|
+
children: n,
|
|
45
|
+
direction: c,
|
|
46
|
+
locale: o = "ru-RU",
|
|
47
|
+
labels: e,
|
|
48
|
+
linkComponent: t,
|
|
49
|
+
className: s,
|
|
50
|
+
...u
|
|
54
51
|
}) => {
|
|
55
|
-
const
|
|
52
|
+
const a = d(
|
|
56
53
|
() => ({
|
|
57
|
-
locale:
|
|
58
|
-
labels: { ...
|
|
59
|
-
linkComponent:
|
|
54
|
+
locale: o,
|
|
55
|
+
labels: { ...C, ...e },
|
|
56
|
+
linkComponent: t
|
|
60
57
|
}),
|
|
61
|
-
[
|
|
58
|
+
[o, e, t]
|
|
62
59
|
);
|
|
63
|
-
return /* @__PURE__ */
|
|
60
|
+
return /* @__PURE__ */ r(E, { locale: o, children: /* @__PURE__ */ r(N, { ...u, className: s, direction: c, value: a, children: n }) });
|
|
64
61
|
}
|
|
65
62
|
);
|
|
66
63
|
export {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
64
|
+
B as AdminUiProvider,
|
|
65
|
+
J as useAuiDirection,
|
|
66
|
+
K as useAuiLabels,
|
|
67
|
+
O as useAuiLink,
|
|
68
|
+
Q as useAuiLocale
|
|
72
69
|
};
|
|
73
70
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/provider/Component.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\n\nimport cn from 'classnames';\nimport { UNSAFE_PortalProvider as PortalProvider } from 'react-aria';\nimport { I18nProvider, useLocale } from 'react-aria-components';\n\nimport { supportRef } from '@ds/common/support-ref';\nimport { typographyStyles } from '@ds/typography';\n\nimport { AuiContext, defaultLabels } from './context';\nimport { type
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/provider/Component.tsx"],"sourcesContent":["import { useCallback, useMemo, useRef, useState, type ElementType, type Ref } from 'react';\n\nimport cn from 'classnames';\nimport { UNSAFE_PortalProvider as PortalProvider } from 'react-aria';\nimport { I18nProvider, useLocale } from 'react-aria-components';\n\nimport { supportRef } from '@ds/common/support-ref';\nimport { typographyStyles } from '@ds/typography';\n\nimport { AuiContext, defaultLabels } from './context';\nimport { type IAuiContextValue, type TAdminUiProviderProps } from './types';\n\nimport styles from './styles.module.css';\n\ntype TRootRef = Ref<HTMLElement>;\n\ntype TAdminUiRootProps = {\n as?: ElementType;\n value: Omit<IAuiContextValue, 'direction'>;\n ref?: TRootRef;\n} & Omit<TAdminUiProviderProps, 'as' | 'locale' | 'labels' | 'linkComponent' | 'ref'>;\n\nconst AdminUiRoot = supportRef(\n ({ as, children, className, direction: directionProp, value, ref, ...props }: TAdminUiRootProps) => {\n const Root = (as ?? 'div') as ElementType;\n const { direction: localeDirection } = useLocale();\n const direction = directionProp ?? localeDirection;\n const [portalEl, setPortalEl] = useState<HTMLElement | null>(null);\n const externalRef = useRef<TRootRef>(ref);\n\n externalRef.current = ref;\n\n const setRootRef = useCallback((node: HTMLElement | null) => {\n setPortalEl(node);\n\n const { current } = externalRef;\n\n if (typeof current === 'function') {\n current(node);\n\n return;\n }\n\n if (current) current.current = node;\n }, []);\n\n const contextValue = useMemo<IAuiContextValue>(\n () => ({\n ...value,\n direction,\n }),\n [value, direction]\n );\n\n return (\n <AuiContext.Provider value={contextValue}>\n <PortalProvider getContainer={() => portalEl}>\n <Root\n {...props}\n ref={setRootRef}\n className={cn(styles.root, typographyStyles.bodyM, className)}\n dir={direction}\n >\n {children}\n </Root>\n </PortalProvider>\n </AuiContext.Provider>\n );\n }\n);\n\nexport const AdminUiProvider = supportRef(\n <P extends ElementType = 'div'>({\n children,\n direction,\n locale = 'ru-RU',\n labels: labelsProp,\n linkComponent,\n className,\n ...props\n }: TAdminUiProviderProps<P>) => {\n const value = useMemo(\n () => ({\n locale,\n labels: { ...defaultLabels, ...labelsProp },\n linkComponent,\n }),\n [locale, labelsProp, linkComponent]\n );\n\n return (\n <I18nProvider locale={locale}>\n <AdminUiRoot {...props} className={className} direction={direction} value={value}>\n {children}\n </AdminUiRoot>\n </I18nProvider>\n );\n }\n);\n"],"names":["AdminUiRoot","supportRef","as","children","className","directionProp","value","ref","props","Root","localeDirection","useLocale","direction","portalEl","setPortalEl","useState","externalRef","useRef","setRootRef","useCallback","node","current","contextValue","useMemo","jsx","AuiContext","PortalProvider","cn","styles","typographyStyles","AdminUiProvider","locale","labelsProp","linkComponent","defaultLabels","I18nProvider"],"mappings":";;;;;;;;;;;GAsBMA,IAAcC;AAAA,EAChB,CAAC,EAAE,IAAAC,GAAI,UAAAC,GAAU,WAAAC,GAAW,WAAWC,GAAe,OAAAC,GAA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AA;AAAA,QAC/B,eAAAC;AAAA,MAAA;AAAA,MAEJ,CAACF,GAAQC,GAAYC,CAAa;AAAA,IAAA;AAGtC,WACI,gBAAAT,EAACW,GAAA,EAAa,QAAAJ,GACV,UAAA,gBAAAP,EAACxB,GAAA,EAAa,GAAGQ,GAAO,WAAAJ,GAAsB,WAAAQ,GAAsB,OAAAN,GAC/D,UAAAH,EAAA,CACL,EAAA,CACJ;AAAA,EAER;AACJ;"}
|
package/dist/provider/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ComponentPropsWithRef, ElementType, ReactNode } from 'react';
|
|
2
|
+
import { TMergeElementProps } from '../ds/common/index.js';
|
|
2
3
|
export type TTextDirection = 'ltr' | 'rtl';
|
|
3
4
|
/** Built-in a11y / UI label strings. */
|
|
4
5
|
export interface IAuiLabels {
|
|
@@ -80,9 +81,10 @@ export interface IAuiContextValue {
|
|
|
80
81
|
/** Host router link. Defaults to `a`. */
|
|
81
82
|
linkComponent?: TAuiLinkComponent;
|
|
82
83
|
}
|
|
83
|
-
|
|
84
|
+
/** Own / chrome props (not from DOM). */
|
|
85
|
+
export interface IAdminUiProviderOwnProps {
|
|
84
86
|
children: ReactNode;
|
|
85
|
-
/** Text direction. Defaults to
|
|
87
|
+
/** Text direction. Defaults to the locale direction. */
|
|
86
88
|
direction?: TTextDirection;
|
|
87
89
|
/** BCP 47 locale. */
|
|
88
90
|
locale?: string;
|
|
@@ -91,4 +93,8 @@ export interface IAdminUiProviderProps extends Omit<ComponentPropsWithRef<'div'>
|
|
|
91
93
|
/** Host router link for menu navigation. Defaults to `a`. */
|
|
92
94
|
linkComponent?: TAuiLinkComponent;
|
|
93
95
|
}
|
|
96
|
+
export type TAdminUiProviderProps<P extends ElementType = 'div'> = {
|
|
97
|
+
/** Root element. Defaults to `div`. */
|
|
98
|
+
as?: P;
|
|
99
|
+
} & Omit<TMergeElementProps<P, IAdminUiProviderOwnProps>, 'dir'>;
|
|
94
100
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/provider/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAErF,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,CAAC;AAE3C,wCAAwC;AACxC,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wCAAwC;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,gBAAgB,EAAE,MAAM,CAAC;IACzB,mEAAmE;IACnE,YAAY,EAAE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,YAAY,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,cAAc,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,cAAc,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,cAAc,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,eAAe,EAAE,MAAM,CAAC;IACxB,0CAA0C;IAC1C,eAAe,EAAE,MAAM,CAAC;IACxB,wCAAwC;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,kCAAkC;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,aAAa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+5,7 @@
|
|
|
5
5
|
| Канал | Где | Для кого |
|
|
6
6
|
| --- | --- | --- |
|
|
7
7
|
| Онбординг / API примитивов | Storybook + `src/<name>/docs/` | люди + агенты |
|
|
8
|
-
| Пакет (этот каталог) | `docs/*.md`, `
|
|
8
|
+
| Пакет (этот каталог) | `docs/*.md`, `ai/skills/` | контрибьюторы, АП |
|
|
9
9
|
| Визуал АП (текст) | [`design-language.md`](./design-language.md) | продукт / дизайн (в npm публикуется) |
|
|
10
10
|
|
|
11
11
|
## В этом каталоге
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
- [architecture.md](./architecture.md) — стек, токены, Form, exports
|
|
14
14
|
- [ai.md](./ai.md) — канал для АП / skills
|
|
15
15
|
- [design-language.md](./design-language.md) — визуальный канон (слои, CascadeMenu WIP, list/detail); в npm уходит [design-language.en.md](./design-language.en.md)
|
|
16
|
-
- [skills/](
|
|
16
|
+
- [`ai/skills/admin-ui/`](../ai/skills/admin-ui/) — skill `admin-ui` (в npm через `ai-sync`; postinstall пишет `.cursor` / `.claude` / `.agents` и блок в `AGENTS.md`, см. [ai.md](./ai.md))
|
|
17
17
|
|
|
18
18
|
## Storybook
|
|
19
19
|
|
package/docs/ai.md
CHANGED
|
@@ -23,25 +23,25 @@ The npm package ships English only, renamed for agents:
|
|
|
23
23
|
|
|
24
24
|
Thin router for **consuming** the UI kit (pick a primitive, then read its Description). Authoring Description / stories — separate skill `write-component-docs`.
|
|
25
25
|
|
|
26
|
-
Location in the package: `
|
|
26
|
+
Location in the package: `ai/skills/admin-ui/SKILL.md`.
|
|
27
27
|
|
|
28
28
|
In a consumer app:
|
|
29
29
|
|
|
30
|
-
- skill — `node_modules/@ensi-platform/admin-ui/
|
|
30
|
+
- skill — `node_modules/@ensi-platform/admin-ui/ai/skills/admin-ui/`
|
|
31
31
|
- contract — `node_modules/@ensi-platform/admin-ui/src/<name>/docs/`, `…/types.ts` (`icons`, `hooks`, `combobox` included)
|
|
32
32
|
|
|
33
|
-
`postinstall` (`
|
|
33
|
+
`postinstall` runs `admin-ui:ai` (`bin/ai.js`). It copies the skill directory and writes a pointer:
|
|
34
34
|
|
|
35
|
-
- `.cursor/skills/admin-ui
|
|
36
|
-
- `.claude/skills/admin-ui
|
|
37
|
-
- marker `<!-- @ensi-platform/admin-ui:start -->` … `:end` in the consumer repo `AGENTS.md` (rest of the file stays)
|
|
35
|
+
- `.cursor/skills/admin-ui/`
|
|
36
|
+
- `.claude/skills/admin-ui/`
|
|
37
|
+
- `.agents/skills/admin-ui/` and marker `<!-- @ensi-platform/admin-ui:start -->` … `:end` in the consumer repo `AGENTS.md` (rest of the file stays)
|
|
38
38
|
|
|
39
39
|
Limits:
|
|
40
40
|
|
|
41
|
-
- consumer root is the nearest `.git` from `INIT_CWD`; if none, the script
|
|
41
|
+
- consumer root is the nearest `.git` from `INIT_CWD`; if none, the script exits and `|| exit 0` keeps `install` green
|
|
42
|
+
- export is skipped inside the admin-ui repository
|
|
42
43
|
- **pnpm ≥ 9** ignores dependency lifecycle scripts until `pnpm approve-builds @ensi-platform/admin-ui` (or `pnpm.onlyBuiltDependencies`), then `pnpm install` again
|
|
43
|
-
- manual run: `
|
|
44
|
-
- opt out of all three: `ADMIN_UI_SKIP_CONSUMER_SYNC=1`
|
|
44
|
+
- manual run: `pnpm exec admin-ui:ai` (`--cursor`, `--claude`, `--codex`; no flags means all three)
|
|
45
45
|
|
|
46
46
|
Updating a Description does not require editing the skill.
|
|
47
47
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ensi-platform/admin-ui",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "Admin UI for Ensi admin panel",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -9,15 +9,10 @@
|
|
|
9
9
|
],
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
|
-
"docs/skills",
|
|
13
12
|
"docs/ai.md",
|
|
14
13
|
"docs/architecture.md",
|
|
15
14
|
"docs/README.md",
|
|
16
15
|
"docs/design-language.md",
|
|
17
|
-
"scripts/consumer-root.ts",
|
|
18
|
-
"scripts/sync-skill-consumer.ts",
|
|
19
|
-
"scripts/sync-agents-consumer.ts",
|
|
20
|
-
"scripts/sync-consumer.ts",
|
|
21
16
|
"src/*/docs/Description.md",
|
|
22
17
|
"src/*/docs/Example.md",
|
|
23
18
|
"src/*/docs/cssVariables.ts",
|
|
@@ -27,7 +22,9 @@
|
|
|
27
22
|
"src/ds/typography/docs/Example.md",
|
|
28
23
|
"src/ds/typography/docs/cssVariables.ts",
|
|
29
24
|
"src/docs/getting-started/Description.md",
|
|
30
|
-
"src/docs/ai/Description.md"
|
|
25
|
+
"src/docs/ai/Description.md",
|
|
26
|
+
"ai",
|
|
27
|
+
"bin"
|
|
31
28
|
],
|
|
32
29
|
"keywords": [
|
|
33
30
|
"ensi",
|
|
@@ -274,7 +271,10 @@
|
|
|
274
271
|
"import": "./dist/vertical-tabs/index.js"
|
|
275
272
|
}
|
|
276
273
|
},
|
|
274
|
+
"bin": {
|
|
275
|
+
"admin-ui:ai": "./bin/ai.js"
|
|
276
|
+
},
|
|
277
277
|
"scripts": {
|
|
278
|
-
"postinstall": "node
|
|
278
|
+
"postinstall": "node ./bin/ai.js || exit 0"
|
|
279
279
|
}
|
|
280
280
|
}
|
|
@@ -23,25 +23,25 @@ The npm package ships English only, renamed for agents:
|
|
|
23
23
|
|
|
24
24
|
Thin router for **consuming** the UI kit (pick a primitive, then read its Description). Authoring Description / stories — separate skill `write-component-docs`.
|
|
25
25
|
|
|
26
|
-
Location in the package: `
|
|
26
|
+
Location in the package: `ai/skills/admin-ui/SKILL.md`.
|
|
27
27
|
|
|
28
28
|
In a consumer app:
|
|
29
29
|
|
|
30
|
-
- skill — `node_modules/@ensi-platform/admin-ui/
|
|
30
|
+
- skill — `node_modules/@ensi-platform/admin-ui/ai/skills/admin-ui/`
|
|
31
31
|
- contract — `node_modules/@ensi-platform/admin-ui/src/<name>/docs/`, `…/types.ts` (`icons`, `hooks`, `combobox` included)
|
|
32
32
|
|
|
33
|
-
`postinstall` (`
|
|
33
|
+
`postinstall` runs `admin-ui:ai` (`bin/ai.js`). It copies the skill directory and writes a pointer:
|
|
34
34
|
|
|
35
|
-
- `.cursor/skills/admin-ui
|
|
36
|
-
- `.claude/skills/admin-ui
|
|
37
|
-
- marker `<!-- @ensi-platform/admin-ui:start -->` … `:end` in the consumer repo `AGENTS.md` (rest of the file stays)
|
|
35
|
+
- `.cursor/skills/admin-ui/`
|
|
36
|
+
- `.claude/skills/admin-ui/`
|
|
37
|
+
- `.agents/skills/admin-ui/` and marker `<!-- @ensi-platform/admin-ui:start -->` … `:end` in the consumer repo `AGENTS.md` (rest of the file stays)
|
|
38
38
|
|
|
39
39
|
Limits:
|
|
40
40
|
|
|
41
|
-
- consumer root is the nearest `.git` from `INIT_CWD`; if none, the script
|
|
41
|
+
- consumer root is the nearest `.git` from `INIT_CWD`; if none, the script exits and `|| exit 0` keeps `install` green
|
|
42
|
+
- export is skipped inside the admin-ui repository
|
|
42
43
|
- **pnpm ≥ 9** ignores dependency lifecycle scripts until `pnpm approve-builds @ensi-platform/admin-ui` (or `pnpm.onlyBuiltDependencies`), then `pnpm install` again
|
|
43
|
-
- manual run: `
|
|
44
|
-
- opt out of all three: `ADMIN_UI_SKIP_CONSUMER_SYNC=1`
|
|
44
|
+
- manual run: `pnpm exec admin-ui:ai` (`--cursor`, `--claude`, `--codex`; no flags means all three)
|
|
45
45
|
|
|
46
46
|
Updating a Description does not require editing the skill.
|
|
47
47
|
|
|
@@ -22,6 +22,7 @@ import { AdminUiProvider, useAuiLabels } from '@ensi-platform/admin-ui/provider'
|
|
|
22
22
|
| `direction` | `ltr` \| `rtl` | from `locale` | text direction |
|
|
23
23
|
| `labels` | `Partial<IAuiLabels>` | Russian strings | override built-in strings |
|
|
24
24
|
| `linkComponent` | link component | `a` | app router (`href` is the item URL) |
|
|
25
|
-
| `
|
|
25
|
+
| `as` | HTML element | `div` | root element. `body` is the document body |
|
|
26
|
+
| `className` | `string` | — | class on the root |
|
|
26
27
|
|
|
27
28
|
Hooks: `useAuiLabels()`, `useAuiLocale()`, `useAuiDirection()`, `useAuiLink()`.
|
package/src/provider/types.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type ComponentPropsWithRef, type ElementType, type ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
+
import { type TMergeElementProps } from '@ds/common';
|
|
4
|
+
|
|
3
5
|
export type TTextDirection = 'ltr' | 'rtl';
|
|
4
6
|
|
|
5
7
|
/** Built-in a11y / UI label strings. */
|
|
@@ -86,9 +88,10 @@ export interface IAuiContextValue {
|
|
|
86
88
|
linkComponent?: TAuiLinkComponent;
|
|
87
89
|
}
|
|
88
90
|
|
|
89
|
-
|
|
91
|
+
/** Own / chrome props (not from DOM). */
|
|
92
|
+
export interface IAdminUiProviderOwnProps {
|
|
90
93
|
children: ReactNode;
|
|
91
|
-
/** Text direction. Defaults to
|
|
94
|
+
/** Text direction. Defaults to the locale direction. */
|
|
92
95
|
direction?: TTextDirection;
|
|
93
96
|
/** BCP 47 locale. */
|
|
94
97
|
locale?: string;
|
|
@@ -97,3 +100,8 @@ export interface IAdminUiProviderProps extends Omit<ComponentPropsWithRef<'div'>
|
|
|
97
100
|
/** Host router link for menu navigation. Defaults to `a`. */
|
|
98
101
|
linkComponent?: TAuiLinkComponent;
|
|
99
102
|
}
|
|
103
|
+
|
|
104
|
+
export type TAdminUiProviderProps<P extends ElementType = 'div'> = {
|
|
105
|
+
/** Root element. Defaults to `div`. */
|
|
106
|
+
as?: P;
|
|
107
|
+
} & Omit<TMergeElementProps<P, IAdminUiProviderOwnProps>, 'dir'>;
|
package/scripts/consumer-root.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { dirname, join, resolve } from 'node:path';
|
|
3
|
-
|
|
4
|
-
/** Env var to fully disable any consumer-repo sync (skills + AGENTS.md). */
|
|
5
|
-
export const SKIP_ENV_VAR = 'ADMIN_UI_SKIP_CONSUMER_SYNC';
|
|
6
|
-
|
|
7
|
-
/** Safety bound for walking up from `startDir` while looking for a `.git` root. */
|
|
8
|
-
const MAX_ANCESTOR_DEPTH = 20;
|
|
9
|
-
|
|
10
|
-
export type TRootStatus = 'skipped-env' | 'skipped-no-git-root' | 'skipped-dev-repo' | 'ok';
|
|
11
|
-
|
|
12
|
-
export interface IConsumerRootResult {
|
|
13
|
-
status: TRootStatus;
|
|
14
|
-
consumerRoot?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/** Walks up from `startDir` looking for the nearest ancestor that contains `.git`. */
|
|
18
|
-
const findGitRoot = (startDir: string, maxDepth = MAX_ANCESTOR_DEPTH): string | undefined => {
|
|
19
|
-
let dir = resolve(startDir);
|
|
20
|
-
|
|
21
|
-
for (let i = 0; i < maxDepth; i += 1) {
|
|
22
|
-
if (existsSync(join(dir, '.git'))) {
|
|
23
|
-
return dir;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const parent = dirname(dir);
|
|
27
|
-
if (parent === dir) {
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
dir = parent;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return undefined;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/** True when `maybeChild` is `root` itself or nested inside it. */
|
|
38
|
-
const isInsideOrEqual = (root: string, maybeChild: string): boolean => {
|
|
39
|
-
const normalizedRoot = resolve(root);
|
|
40
|
-
const normalizedChild = resolve(maybeChild);
|
|
41
|
-
|
|
42
|
-
return normalizedChild === normalizedRoot || normalizedChild.startsWith(`${normalizedRoot}/`);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Resolves the consumer repo root (nearest `.git` ancestor of `startDir`), guarding
|
|
47
|
-
* against the package's own dev install and against a full opt-out env var.
|
|
48
|
-
* Shared by skill sync and AGENTS.md sync so both agree on the same root.
|
|
49
|
-
*/
|
|
50
|
-
export const resolveConsumerRoot = (packageRoot: string, startDir: string): IConsumerRootResult => {
|
|
51
|
-
if (process.env[SKIP_ENV_VAR]) {
|
|
52
|
-
return { status: 'skipped-env' };
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const consumerRoot = findGitRoot(startDir);
|
|
56
|
-
if (!consumerRoot) {
|
|
57
|
-
return { status: 'skipped-no-git-root' };
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Running inside the admin-ui repo itself (dev install) — do not self-mirror.
|
|
61
|
-
if (isInsideOrEqual(packageRoot, consumerRoot)) {
|
|
62
|
-
return { status: 'skipped-dev-repo' };
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return { status: 'ok', consumerRoot };
|
|
66
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
|
|
4
|
-
import { resolveConsumerRoot } from './consumer-root.ts';
|
|
5
|
-
|
|
6
|
-
const AGENTS_TARGET_RELATIVE = 'AGENTS.md';
|
|
7
|
-
|
|
8
|
-
const BLOCK_START = '<!-- @ensi-platform/admin-ui:start -->';
|
|
9
|
-
const BLOCK_END = '<!-- @ensi-platform/admin-ui:end -->';
|
|
10
|
-
|
|
11
|
-
const BLOCK_BODY = [
|
|
12
|
-
'## @ensi-platform/admin-ui',
|
|
13
|
-
'',
|
|
14
|
-
'When building or changing Ensi admin screens, forms, filters, or overlays, use `@ensi-platform/admin-ui` primitives.',
|
|
15
|
-
'Before coding, read `node_modules/@ensi-platform/admin-ui/docs/ai.md` and the relevant',
|
|
16
|
-
'`src/<name>/docs/Description.md` / `types.ts` — do not invent the API.',
|
|
17
|
-
'For whole screens (lists, filters, detail pages) also follow `node_modules/@ensi-platform/admin-ui/docs/design-language.md`.',
|
|
18
|
-
].join('\n');
|
|
19
|
-
|
|
20
|
-
const buildBlock = (): string => `${BLOCK_START}\n${BLOCK_BODY}\n${BLOCK_END}`;
|
|
21
|
-
|
|
22
|
-
const resolveSeparator = (existing: string): string => {
|
|
23
|
-
if (existing.endsWith('\n\n')) {
|
|
24
|
-
return '';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (existing.endsWith('\n')) {
|
|
28
|
-
return '\n';
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return '\n\n';
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/** Replaces the marked block if present, otherwise appends it; never touches the rest of the file. */
|
|
35
|
-
const upsertBlock = (existing: string | undefined, block: string): string => {
|
|
36
|
-
if (existing === undefined) {
|
|
37
|
-
return `${block}\n`;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const startIndex = existing.indexOf(BLOCK_START);
|
|
41
|
-
const endIndex = existing.indexOf(BLOCK_END);
|
|
42
|
-
|
|
43
|
-
if (startIndex !== -1 && endIndex !== -1 && endIndex > startIndex) {
|
|
44
|
-
const before = existing.slice(0, startIndex);
|
|
45
|
-
const after = existing.slice(endIndex + BLOCK_END.length);
|
|
46
|
-
return `${before}${block}${after}`;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return `${existing}${resolveSeparator(existing)}${block}\n`;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export type TAgentsSyncStatus = 'skipped-env' | 'skipped-no-git-root' | 'skipped-dev-repo' | 'written' | 'unchanged';
|
|
53
|
-
|
|
54
|
-
export interface IAgentsSyncResult {
|
|
55
|
-
status: TAgentsSyncStatus;
|
|
56
|
-
targetPath?: string;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Upserts a marker-delimited block in the consumer repo's `AGENTS.md`, so agents
|
|
61
|
-
* without a Skills concept (Codex CLI, Copilot coding agent, …) still get a pointer
|
|
62
|
-
* to `docs/ai.md`. Never overwrites content outside the marker block.
|
|
63
|
-
*/
|
|
64
|
-
export const syncAgentsToConsumer = (packageRoot: string, startDir: string): IAgentsSyncResult => {
|
|
65
|
-
const root = resolveConsumerRoot(packageRoot, startDir);
|
|
66
|
-
if (root.status !== 'ok') {
|
|
67
|
-
return { status: root.status };
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const targetPath = join(root.consumerRoot as string, AGENTS_TARGET_RELATIVE);
|
|
71
|
-
const existing = existsSync(targetPath) ? readFileSync(targetPath, 'utf8') : undefined;
|
|
72
|
-
const nextContent = upsertBlock(existing, buildBlock());
|
|
73
|
-
|
|
74
|
-
if (existing === nextContent) {
|
|
75
|
-
return { status: 'unchanged', targetPath };
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
writeFileSync(targetPath, nextContent);
|
|
79
|
-
|
|
80
|
-
return { status: 'written', targetPath };
|
|
81
|
-
};
|
package/scripts/sync-consumer.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { dirname, resolve } from 'node:path';
|
|
2
|
-
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
3
|
-
|
|
4
|
-
import { syncAgentsToConsumer } from './sync-agents-consumer.ts';
|
|
5
|
-
import { syncSkillToConsumer } from './sync-skill-consumer.ts';
|
|
6
|
-
|
|
7
|
-
const isCli = process.argv[1] !== undefined && pathToFileURL(resolve(process.argv[1])).href === import.meta.url;
|
|
8
|
-
|
|
9
|
-
if (isCli) {
|
|
10
|
-
try {
|
|
11
|
-
const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
12
|
-
const startDir = process.env.INIT_CWD || process.cwd();
|
|
13
|
-
|
|
14
|
-
const skillResult = syncSkillToConsumer(packageRoot, startDir);
|
|
15
|
-
if (skillResult.status === 'done') {
|
|
16
|
-
skillResult.targets?.forEach(target => {
|
|
17
|
-
if (target.status === 'written') {
|
|
18
|
-
console.info(`[admin-ui] skill synced to ${target.targetPath}`);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const agentsResult = syncAgentsToConsumer(packageRoot, startDir);
|
|
24
|
-
if (agentsResult.status === 'written') {
|
|
25
|
-
console.info(`[admin-ui] AGENTS.md updated at ${agentsResult.targetPath}`);
|
|
26
|
-
}
|
|
27
|
-
} catch (error) {
|
|
28
|
-
// Never let a sync failure break `pnpm install` for the consumer.
|
|
29
|
-
console.warn('[admin-ui] consumer sync skipped:', error instanceof Error ? error.message : error);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { dirname, join } from 'node:path';
|
|
3
|
-
|
|
4
|
-
import { resolveConsumerRoot } from './consumer-root.ts';
|
|
5
|
-
|
|
6
|
-
/** Published skill doc inside this package. */
|
|
7
|
-
const SKILL_SOURCE_RELATIVE = 'docs/skills/SKILL.md';
|
|
8
|
-
|
|
9
|
-
/** Where skills-aware agents look for this skill in the consumer repo. */
|
|
10
|
-
const SKILL_TARGETS_RELATIVE = ['.cursor/skills/admin-ui/SKILL.md', '.claude/skills/admin-ui/SKILL.md'];
|
|
11
|
-
|
|
12
|
-
export interface ITargetResult {
|
|
13
|
-
targetPath: string;
|
|
14
|
-
status: 'written' | 'unchanged';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type TSkillSyncStatus =
|
|
18
|
-
'skipped-env' | 'skipped-no-git-root' | 'skipped-dev-repo' | 'skipped-no-source' | 'done';
|
|
19
|
-
|
|
20
|
-
export interface ISkillSyncResult {
|
|
21
|
-
status: TSkillSyncStatus;
|
|
22
|
-
targets?: ITargetResult[];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const writeIfChanged = (targetPath: string, content: string): ITargetResult => {
|
|
26
|
-
if (existsSync(targetPath) && readFileSync(targetPath, 'utf8') === content) {
|
|
27
|
-
return { targetPath, status: 'unchanged' };
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
mkdirSync(dirname(targetPath), { recursive: true });
|
|
31
|
-
writeFileSync(targetPath, content);
|
|
32
|
-
|
|
33
|
-
return { targetPath, status: 'written' };
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Copies the published skill doc into every known skills-aware agent directory
|
|
38
|
-
* in the consumer repo (Cursor, Claude Code), so they pick it up without manual
|
|
39
|
-
* setup. Never throws — a consumer's install must never fail because of this.
|
|
40
|
-
*/
|
|
41
|
-
export const syncSkillToConsumer = (packageRoot: string, startDir: string): ISkillSyncResult => {
|
|
42
|
-
const root = resolveConsumerRoot(packageRoot, startDir);
|
|
43
|
-
if (root.status !== 'ok') {
|
|
44
|
-
return { status: root.status };
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const sourcePath = join(packageRoot, SKILL_SOURCE_RELATIVE);
|
|
48
|
-
if (!existsSync(sourcePath)) {
|
|
49
|
-
return { status: 'skipped-no-source' };
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const content = readFileSync(sourcePath, 'utf8');
|
|
53
|
-
const consumerRoot = root.consumerRoot as string;
|
|
54
|
-
const targets = SKILL_TARGETS_RELATIVE.map(relative => writeIfChanged(join(consumerRoot, relative), content));
|
|
55
|
-
|
|
56
|
-
return { status: 'done', targets };
|
|
57
|
-
};
|
|
File without changes
|