@preply/ds-ai-core 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +7 -0
- package/README.md +34 -0
- package/dist/event-tracking.d.ts +21 -0
- package/dist/event-tracking.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38209 -0
- package/dist/tools/components/__tests__/get-component-docs.test.d.ts +2 -0
- package/dist/tools/components/__tests__/get-component-docs.test.d.ts.map +1 -0
- package/dist/tools/components/__tests__/list-components.test.d.ts +2 -0
- package/dist/tools/components/__tests__/list-components.test.d.ts.map +1 -0
- package/dist/tools/components/context/__test__/get-components-data.test.d.ts +2 -0
- package/dist/tools/components/context/__test__/get-components-data.test.d.ts.map +1 -0
- package/dist/tools/components/context/__test__/test-components/FixtureButton.d.ts +15 -0
- package/dist/tools/components/context/__test__/test-components/FixtureButton.d.ts.map +1 -0
- package/dist/tools/components/context/__test__/test-components/index.d.ts +2 -0
- package/dist/tools/components/context/__test__/test-components/index.d.ts.map +1 -0
- package/dist/tools/components/context/extract-component-docgen-info.d.ts +3 -0
- package/dist/tools/components/context/extract-component-docgen-info.d.ts.map +1 -0
- package/dist/tools/components/context/get-components-data.d.ts +24 -0
- package/dist/tools/components/context/get-components-data.d.ts.map +1 -0
- package/dist/tools/components/context/index.d.ts +6 -0
- package/dist/tools/components/context/index.d.ts.map +1 -0
- package/dist/tools/components/context/render-component-doc.d.ts +4 -0
- package/dist/tools/components/context/render-component-doc.d.ts.map +1 -0
- package/dist/tools/components/get-component-docs.d.ts +15 -0
- package/dist/tools/components/get-component-docs.d.ts.map +1 -0
- package/dist/tools/components/list-components.d.ts +9 -0
- package/dist/tools/components/list-components.d.ts.map +1 -0
- package/dist/tools/index.d.ts +6 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/search-icon/__tests__/get-icons-data.test.d.ts +2 -0
- package/dist/tools/search-icon/__tests__/get-icons-data.test.d.ts.map +1 -0
- package/dist/tools/search-icon/__tests__/search-icon.test.d.ts +2 -0
- package/dist/tools/search-icon/__tests__/search-icon.test.d.ts.map +1 -0
- package/dist/tools/search-icon/get-icons-data.d.ts +6 -0
- package/dist/tools/search-icon/get-icons-data.d.ts.map +1 -0
- package/dist/tools/search-icon/search-icon.d.ts +18 -0
- package/dist/tools/search-icon/search-icon.d.ts.map +1 -0
- package/dist/tools/search-token/__tests__/search-token-by-name.test.d.ts +2 -0
- package/dist/tools/search-token/__tests__/search-token-by-name.test.d.ts.map +1 -0
- package/dist/tools/search-token/__tests__/search-token-by-value.test.d.ts +2 -0
- package/dist/tools/search-token/__tests__/search-token-by-value.test.d.ts.map +1 -0
- package/dist/tools/search-token/context/__tests__/get-tokens-data.test.d.ts +2 -0
- package/dist/tools/search-token/context/__tests__/get-tokens-data.test.d.ts.map +1 -0
- package/dist/tools/search-token/context/get-tokens-data.d.ts +13 -0
- package/dist/tools/search-token/context/get-tokens-data.d.ts.map +1 -0
- package/dist/tools/search-token/context/index.d.ts +6 -0
- package/dist/tools/search-token/context/index.d.ts.map +1 -0
- package/dist/tools/search-token/search-token-by-name.d.ts +26 -0
- package/dist/tools/search-token/search-token-by-name.d.ts.map +1 -0
- package/dist/tools/search-token/search-token-by-value.d.ts +24 -0
- package/dist/tools/search-token/search-token-by-value.d.ts.map +1 -0
- package/dist/tools/search-token/token-utils.d.ts +9 -0
- package/dist/tools/search-token/token-utils.d.ts.map +1 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/create-search-index.d.ts +48 -0
- package/dist/utils/create-search-index.d.ts.map +1 -0
- package/dist/utils/define-tool.d.ts +49 -0
- package/dist/utils/define-tool.d.ts.map +1 -0
- package/dist/utils/format-list.d.ts +26 -0
- package/dist/utils/format-list.d.ts.map +1 -0
- package/dist/utils/md.d.ts +24 -0
- package/dist/utils/md.d.ts.map +1 -0
- package/package.json +48 -0
- package/src/event-tracking.ts +117 -0
- package/src/index.ts +4 -0
- package/src/tools/components/__tests__/get-component-docs.test.ts +58 -0
- package/src/tools/components/__tests__/list-components.test.ts +63 -0
- package/src/tools/components/context/__test__/get-components-data.test.ts +57 -0
- package/src/tools/components/context/__test__/test-components/FixtureButton.tsx +18 -0
- package/src/tools/components/context/__test__/test-components/index.ts +1 -0
- package/src/tools/components/context/__test__/test-components/tsconfig.json +11 -0
- package/src/tools/components/context/extract-component-docgen-info.ts +108 -0
- package/src/tools/components/context/get-components-data.ts +94 -0
- package/src/tools/components/context/index.ts +4 -0
- package/src/tools/components/context/render-component-doc.ts +89 -0
- package/src/tools/components/get-component-docs.ts +26 -0
- package/src/tools/components/list-components.ts +36 -0
- package/src/tools/index.ts +5 -0
- package/src/tools/search-icon/__tests__/get-icons-data.test.ts +22 -0
- package/src/tools/search-icon/__tests__/search-icon.test.ts +235 -0
- package/src/tools/search-icon/__tests__/test-icons/NotIcon.md +1 -0
- package/src/tools/search-icon/__tests__/test-icons/OtherIcon.svg +1 -0
- package/src/tools/search-icon/__tests__/test-icons/TokyoUIClose.svg +1 -0
- package/src/tools/search-icon/__tests__/test-icons/TokyoUIHelp.svg +1 -0
- package/src/tools/search-icon/get-icons-data.ts +19 -0
- package/src/tools/search-icon/search-icon.ts +100 -0
- package/src/tools/search-token/__tests__/search-token-by-name.test.ts +384 -0
- package/src/tools/search-token/__tests__/search-token-by-value.test.ts +250 -0
- package/src/tools/search-token/context/__tests__/get-tokens-data.test.ts +148 -0
- package/src/tools/search-token/context/get-tokens-data.ts +103 -0
- package/src/tools/search-token/context/index.ts +4 -0
- package/src/tools/search-token/search-token-by-name.ts +110 -0
- package/src/tools/search-token/search-token-by-value.ts +107 -0
- package/src/tools/search-token/token-utils.ts +60 -0
- package/src/types.ts +3 -0
- package/src/utils/create-search-index.ts +121 -0
- package/src/utils/define-tool.ts +67 -0
- package/src/utils/format-list.ts +38 -0
- package/src/utils/md.ts +12 -0
- package/tsconfig.json +11 -0
- package/vite.config.ts +23 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-component-docs.test.d.ts","sourceRoot":"","sources":["../../../../src/tools/components/__tests__/get-component-docs.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-components.test.d.ts","sourceRoot":"","sources":["../../../../src/tools/components/__tests__/list-components.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-components-data.test.d.ts","sourceRoot":"","sources":["../../../../../src/tools/components/context/__test__/get-components-data.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type FixtureButtonProps = {
|
|
3
|
+
/** Visible button label */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Disabled state */
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Lightweight fixture component used in docs generation tests.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <FixtureButton label="Save" />
|
|
13
|
+
*/
|
|
14
|
+
export declare const FixtureButton: ({ label, disabled }: FixtureButtonProps) => React.JSX.Element;
|
|
15
|
+
//# sourceMappingURL=FixtureButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FixtureButton.d.ts","sourceRoot":"","sources":["../../../../../../src/tools/components/context/__test__/test-components/FixtureButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,kBAAkB,GAAG;IAC7B,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,wBAAiC,kBAAkB,sBAE5E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/tools/components/context/__test__/test-components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-component-docgen-info.d.ts","sourceRoot":"","sources":["../../../../src/tools/components/context/extract-component-docgen-info.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAuB,MAAM,yBAAyB,CAAC;AAgC5E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,GAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAO,kBAwEtF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type Entry = {
|
|
2
|
+
importPath: string;
|
|
3
|
+
entrypoint: string;
|
|
4
|
+
ignoreErrors?: (string | RegExp)[];
|
|
5
|
+
};
|
|
6
|
+
export type ComponentMeta = {
|
|
7
|
+
name: string;
|
|
8
|
+
import: string;
|
|
9
|
+
description: string;
|
|
10
|
+
deprecated?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type ComponentInfo = {
|
|
13
|
+
meta: ComponentMeta;
|
|
14
|
+
docs: string;
|
|
15
|
+
};
|
|
16
|
+
export type ComponentsMap = Record<string, ComponentInfo>;
|
|
17
|
+
type PlatformComponents = {
|
|
18
|
+
web: ComponentsMap;
|
|
19
|
+
'react-native': ComponentsMap;
|
|
20
|
+
};
|
|
21
|
+
export declare function buildComponents(entries: Entry[]): ComponentsMap;
|
|
22
|
+
export declare function getComponentsData(): PlatformComponents;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=get-components-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-components-data.d.ts","sourceRoot":"","sources":["../../../../src/tools/components/context/get-components-data.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,KAAK,GAAG;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAE1D,KAAK,kBAAkB,GAAG;IACtB,GAAG,EAAE,aAAa,CAAC;IACnB,cAAc,EAAE,aAAa,CAAC;CACjC,CAAC;AAEF,wBAAgB,eAAe,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,aAAa,CA0B/D;AAID,wBAAgB,iBAAiB,IAAI,kBAAkB,CAkCtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/components/context/index.ts"],"names":[],"mappings":";;;;AAGA,wBAAmC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ComponentDoc } from 'react-docgen-typescript';
|
|
2
|
+
export declare function renderComponentDoc(docgenInfo: ComponentDoc, importPath: string): string;
|
|
3
|
+
export declare function renderImportExample(docgenInfo: ComponentDoc, importPath: string): string;
|
|
4
|
+
//# sourceMappingURL=render-component-doc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-component-doc.d.ts","sourceRoot":"","sources":["../../../../src/tools/components/context/render-component-doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAY,MAAM,yBAAyB,CAAC;AAGjE,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAU9E;AAED,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAG/E"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
export declare const getComponentDocs: import('../../utils/define-tool').Tool<z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
name: string;
|
|
6
|
+
}, {
|
|
7
|
+
name: string;
|
|
8
|
+
}>, z.ZodObject<{
|
|
9
|
+
platform: z.ZodEnum<["web", "react-native"]>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
platform: "web" | "react-native";
|
|
12
|
+
}, {
|
|
13
|
+
platform: "web" | "react-native";
|
|
14
|
+
}>>;
|
|
15
|
+
//# sourceMappingURL=get-component-docs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-component-docs.d.ts","sourceRoot":"","sources":["../../../src/tools/components/get-component-docs.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;GAoB3B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
export declare const listComponents: import('../../utils/define-tool').Tool<never, z.ZodObject<{
|
|
3
|
+
platform: z.ZodEnum<["web", "react-native"]>;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
platform: "web" | "react-native";
|
|
6
|
+
}, {
|
|
7
|
+
platform: "web" | "react-native";
|
|
8
|
+
}>>;
|
|
9
|
+
//# sourceMappingURL=list-components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-components.d.ts","sourceRoot":"","sources":["../../../src/tools/components/list-components.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAIzB,eAAO,MAAM,cAAc;;;;;;GA4BzB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { searchIcon } from './search-icon/search-icon';
|
|
2
|
+
export { searchTokenByName } from './search-token/search-token-by-name';
|
|
3
|
+
export { searchTokenByValue } from './search-token/search-token-by-value';
|
|
4
|
+
export { listComponents } from './components/list-components';
|
|
5
|
+
export { getComponentDocs } from './components/get-component-docs';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-icons-data.test.d.ts","sourceRoot":"","sources":["../../../../src/tools/search-icon/__tests__/get-icons-data.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-icon.test.d.ts","sourceRoot":"","sources":["../../../../src/tools/search-icon/__tests__/search-icon.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-icons-data.d.ts","sourceRoot":"","sources":["../../../src/tools/search-icon/get-icons-data.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,CAAC,YAAY,SAAgB;;;IAUxD;AAED,MAAM,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
export declare const searchIcon: import('../../utils/define-tool').Tool<z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
name: string;
|
|
6
|
+
}, {
|
|
7
|
+
name: string;
|
|
8
|
+
}>, z.ZodObject<{
|
|
9
|
+
platform: z.ZodEnum<["web", "react-native"]>;
|
|
10
|
+
includeExample: z.ZodDefault<z.ZodBoolean>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
platform: "web" | "react-native";
|
|
13
|
+
includeExample: boolean;
|
|
14
|
+
}, {
|
|
15
|
+
platform: "web" | "react-native";
|
|
16
|
+
includeExample?: boolean | undefined;
|
|
17
|
+
}>>;
|
|
18
|
+
//# sourceMappingURL=search-icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-icon.d.ts","sourceRoot":"","sources":["../../../src/tools/search-icon/search-icon.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAyCzB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;GAmDrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-token-by-name.test.d.ts","sourceRoot":"","sources":["../../../../src/tools/search-token/__tests__/search-token-by-name.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-token-by-value.test.d.ts","sourceRoot":"","sources":["../../../../src/tools/search-token/__tests__/search-token-by-value.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-tokens-data.test.d.ts","sourceRoot":"","sources":["../../../../../src/tools/search-token/context/__tests__/get-tokens-data.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Platform } from '../../../types';
|
|
2
|
+
export type TokenData = {
|
|
3
|
+
name: string;
|
|
4
|
+
scss: string;
|
|
5
|
+
less: string;
|
|
6
|
+
typescript: string;
|
|
7
|
+
value: string | number;
|
|
8
|
+
private: boolean;
|
|
9
|
+
};
|
|
10
|
+
type PlatformTokens = Record<Platform, TokenData[]>;
|
|
11
|
+
export declare function getTokensData(): PlatformTokens;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=get-tokens-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-tokens-data.d.ts","sourceRoot":"","sources":["../../../../src/tools/search-token/context/get-tokens-data.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AA8E1C,MAAM,MAAM,SAAS,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,KAAK,cAAc,GAAG,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;AAEpD,wBAAgB,aAAa,IAAI,cAAc,CAU9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/search-token/context/index.ts"],"names":[],"mappings":";;;;AAGA,wBAA+B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Format } from './token-utils';
|
|
2
|
+
import * as z from 'zod';
|
|
3
|
+
export type { Format };
|
|
4
|
+
export declare const searchTokenByName: import('../../utils/define-tool').Tool<z.ZodObject<{
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
name: string;
|
|
8
|
+
}, {
|
|
9
|
+
name: string;
|
|
10
|
+
}>, z.ZodObject<{
|
|
11
|
+
platform: z.ZodEnum<["web", "react-native"]>;
|
|
12
|
+
format: z.ZodDefault<z.ZodOptional<z.ZodEnum<["scss", "less", "typescript"]>>>;
|
|
13
|
+
includeExample: z.ZodDefault<z.ZodBoolean>;
|
|
14
|
+
includePrivate: z.ZodDefault<z.ZodBoolean>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
platform: "web" | "react-native";
|
|
17
|
+
includeExample: boolean;
|
|
18
|
+
format: "scss" | "less" | "typescript";
|
|
19
|
+
includePrivate: boolean;
|
|
20
|
+
}, {
|
|
21
|
+
platform: "web" | "react-native";
|
|
22
|
+
includeExample?: boolean | undefined;
|
|
23
|
+
format?: "scss" | "less" | "typescript" | undefined;
|
|
24
|
+
includePrivate?: boolean | undefined;
|
|
25
|
+
}>>;
|
|
26
|
+
//# sourceMappingURL=search-token-by-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-token-by-name.d.ts","sourceRoot":"","sources":["../../../src/tools/search-token/search-token-by-name.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAIzB,OAAO,EAAE,MAAM,EAA2B,MAAM,eAAe,CAAC;AAEhE,YAAY,EAAE,MAAM,EAAE,CAAC;AAoBvB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;GA+E5B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
export declare const searchTokenByValue: import('../../utils/define-tool').Tool<z.ZodObject<{
|
|
3
|
+
value: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
value: string;
|
|
6
|
+
}, {
|
|
7
|
+
value: string;
|
|
8
|
+
}>, z.ZodObject<{
|
|
9
|
+
platform: z.ZodEnum<["web", "react-native"]>;
|
|
10
|
+
format: z.ZodDefault<z.ZodOptional<z.ZodEnum<["scss", "less", "typescript"]>>>;
|
|
11
|
+
includeExample: z.ZodDefault<z.ZodBoolean>;
|
|
12
|
+
includePrivate: z.ZodDefault<z.ZodBoolean>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
platform: "web" | "react-native";
|
|
15
|
+
includeExample: boolean;
|
|
16
|
+
format: "scss" | "less" | "typescript";
|
|
17
|
+
includePrivate: boolean;
|
|
18
|
+
}, {
|
|
19
|
+
platform: "web" | "react-native";
|
|
20
|
+
includeExample?: boolean | undefined;
|
|
21
|
+
format?: "scss" | "less" | "typescript" | undefined;
|
|
22
|
+
includePrivate?: boolean | undefined;
|
|
23
|
+
}>>;
|
|
24
|
+
//# sourceMappingURL=search-token-by-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-token-by-value.d.ts","sourceRoot":"","sources":["../../../src/tools/search-token/search-token-by-value.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAuCzB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;GA8D7B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TokenData } from './context/get-tokens-data';
|
|
2
|
+
import { Platform } from '../../types';
|
|
3
|
+
export type Format = 'scss' | 'less' | 'typescript';
|
|
4
|
+
export declare function formatToken(token: TokenData, platform: Platform, format: Format): {
|
|
5
|
+
token: string;
|
|
6
|
+
value: string | number;
|
|
7
|
+
};
|
|
8
|
+
export declare function getExample(platform: Platform, format: Format): string;
|
|
9
|
+
//# sourceMappingURL=token-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-utils.d.ts","sourceRoot":"","sources":["../../../src/tools/search-token/token-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC;AAEpD,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM;;;EAK/E;AA8CD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,UAE5D"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,cAAc,CAAC;AAE9C,eAAO,MAAM,SAAS,yBAAwD,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
type Result<T> = {
|
|
2
|
+
item: T;
|
|
3
|
+
/** Whether the query matched a ref exactly (as opposed to a fuzzy/partial match). */
|
|
4
|
+
exact: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Extracts only the keys of T whose values are strings.
|
|
8
|
+
* Used to constrain `ref` so it always points to a string field.
|
|
9
|
+
*/
|
|
10
|
+
type StringKeys<T extends Record<string, unknown>, K = keyof T> = K extends string ? T[K] extends string ? K : never : never;
|
|
11
|
+
/**
|
|
12
|
+
* Builds a lunr full-text search index over `items` and returns a thin wrapper
|
|
13
|
+
* with `search` (ranked results) and `get` (exact lookup) methods.
|
|
14
|
+
*
|
|
15
|
+
* @param items - The dataset to index.
|
|
16
|
+
* @param ref - Which string field to use as the unique document key.
|
|
17
|
+
* @param normalize - Optional transform applied to both stored refs and incoming
|
|
18
|
+
* queries so that e.g. case or naming-convention differences
|
|
19
|
+
* don't prevent matches. When provided, a custom pipeline
|
|
20
|
+
* function is also registered to split compound tokens.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createSearchIndex<T extends Record<string, unknown>>(
|
|
23
|
+
/** The dataset to index. */
|
|
24
|
+
items: T[], options: {
|
|
25
|
+
/** The field to use as the unique document key. */
|
|
26
|
+
ref: StringKeys<T>;
|
|
27
|
+
/** An optional transform applied to both stored refs and incoming queries */
|
|
28
|
+
normalize?: (term: string) => string;
|
|
29
|
+
}): {
|
|
30
|
+
/**
|
|
31
|
+
* Performs a full-text search over the indexed items.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const results = index.search('dropShadow-1-shorthand');
|
|
36
|
+
* console.log(results);
|
|
37
|
+
* // [
|
|
38
|
+
* // { item: { name: 'dropShadow-1-shorthand' }, exact: true },
|
|
39
|
+
* // { item: { name: 'dropShadow-1-shorthand' }, exact: false },
|
|
40
|
+
* // ]
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
search(query: string, limit?: number): Result<T>[];
|
|
44
|
+
/** Direct lookup by normalized ref value. Returns undefined if not found. */
|
|
45
|
+
get(query: string): T | undefined;
|
|
46
|
+
};
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=create-search-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-search-index.d.ts","sourceRoot":"","sources":["../../src/utils/create-search-index.ts"],"names":[],"mappings":"AAOA,KAAK,MAAM,CAAC,CAAC,IAAI;IACb,IAAI,EAAE,CAAC,CAAC;IACR,qFAAqF;IACrF,KAAK,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,KAAK,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,MAAM,GAC5E,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACf,CAAC,GACD,KAAK,GACT,KAAK,CAAC;AAEZ;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;AAC/D,4BAA4B;AAC5B,KAAK,EAAE,CAAC,EAAE,EACV,OAAO,EAAE;IACL,mDAAmD;IACnD,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACnB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACxC;IAiDG;;;;;;;;;;;;OAYG;kBACW,MAAM,UAAU,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE;IAWlD,6EAA6E;eAClE,MAAM,GAAG,CAAC,GAAG,SAAS;EAIxC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves callback parameter types based on which schemas a tool defines.
|
|
4
|
+
* Uses `[T] extends [never]` (wrapped in tuple) instead of `T extends never`
|
|
5
|
+
* to prevent TypeScript from collapsing the conditional via distributive behavior.
|
|
6
|
+
*
|
|
7
|
+
* - Both Arguments and Options are `never` -> callback takes no parameters
|
|
8
|
+
* - Only Options defined -> callback takes parsed Options
|
|
9
|
+
* - Only Arguments defined -> callback takes parsed Arguments
|
|
10
|
+
* - Both defined -> callback takes merged Arguments & Options
|
|
11
|
+
*/
|
|
12
|
+
type CallbackParameters<Arguments extends z.AnyZodObject = never, Options extends z.AnyZodObject = never> = [Arguments] extends [never] ? [Options] extends [never] ? [] : [z.input<Options>] : [Options] extends [never] ? [z.input<Arguments>] : [z.input<Arguments> & z.input<Options>];
|
|
13
|
+
/**
|
|
14
|
+
* Shape of a single AI tool definition.
|
|
15
|
+
*
|
|
16
|
+
* A tool has a CLI-style interface with positional `arguments` and named
|
|
17
|
+
* `options`, both validated at runtime via Zod schemas. The `callback`
|
|
18
|
+
* receives the parsed (and type-safe) values and must return an array of
|
|
19
|
+
* output lines that are surfaced to the calling agent.
|
|
20
|
+
*/
|
|
21
|
+
export type Tool<Arguments extends z.AnyZodObject = never, Options extends z.AnyZodObject = never> = {
|
|
22
|
+
/** The tool name. Used when using as MCP tool. */
|
|
23
|
+
name: string;
|
|
24
|
+
/** The tool description. Used when using as MCP tool and displayed as a help message to CLI command. */
|
|
25
|
+
description: string;
|
|
26
|
+
/** Positional arguments schema. Omit if the tool takes no positional args. */
|
|
27
|
+
arguments?: Arguments;
|
|
28
|
+
/** Named options/flags schema. Omit if the tool takes no options. */
|
|
29
|
+
options?: Options;
|
|
30
|
+
/** Executes the tool logic; returns output lines shown to the agent. */
|
|
31
|
+
callback: (...args: CallbackParameters<Arguments, Options>) => string[];
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Identity helper that infers the generic types from the tool object literal,
|
|
35
|
+
* giving full type-safety on `callback` params without manual type annotations.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const myTool = defineTool({
|
|
40
|
+
* name: 'greet',
|
|
41
|
+
* description: 'Say hello',
|
|
42
|
+
* arguments: z.object({ name: z.string() }),
|
|
43
|
+
* callback: (args) => [`Hello, ${args.name}!`], // args is typed automatically
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function defineTool<Arguments extends z.AnyZodObject = never, Options extends z.AnyZodObject = never>(tool: Tool<Arguments, Options>): Tool<Arguments, Options>;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=define-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-tool.d.ts","sourceRoot":"","sources":["../../src/utils/define-tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB;;;;;;;;;GASG;AACH,KAAK,kBAAkB,CACnB,SAAS,SAAS,CAAC,CAAC,YAAY,GAAG,KAAK,EACxC,OAAO,SAAS,CAAC,CAAC,YAAY,GAAG,KAAK,IACtC,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,GACzB,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,GACrB,EAAE,GACF,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GACtB,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,GACvB,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GACpB,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,MAAM,IAAI,CACZ,SAAS,SAAS,CAAC,CAAC,YAAY,GAAG,KAAK,EACxC,OAAO,SAAS,CAAC,CAAC,YAAY,GAAG,KAAK,IACtC;IACA,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,wGAAwG;IACxG,WAAW,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wEAAwE;IACxE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC;CAC3E,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CACtB,SAAS,SAAS,CAAC,CAAC,YAAY,GAAG,KAAK,EACxC,OAAO,SAAS,CAAC,CAAC,YAAY,GAAG,KAAK,EACxC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,4BAE/B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a list of objects into readable string.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```
|
|
6
|
+
* const list = [
|
|
7
|
+
* { name: 'John', age: 30 },
|
|
8
|
+
* { name: 'Jane', age: 25 },
|
|
9
|
+
* ];
|
|
10
|
+
* const formattedList = formatList(list);
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* returns:
|
|
14
|
+
* ```
|
|
15
|
+
* ---
|
|
16
|
+
* name: John
|
|
17
|
+
* age: 30
|
|
18
|
+
* ---
|
|
19
|
+
* name: Jane
|
|
20
|
+
* age: 25
|
|
21
|
+
* ---
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatList(list: unknown[]): string;
|
|
25
|
+
export declare function formatListInline(list: unknown[]): string;
|
|
26
|
+
//# sourceMappingURL=format-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-list.d.ts","sourceRoot":"","sources":["../../src/utils/format-list.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,UAMzC;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,UAI/C"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as tsmd from 'ts-markdown-builder';
|
|
2
|
+
declare function frontMatter(object: Record<string, unknown>): string;
|
|
3
|
+
export declare const md: {
|
|
4
|
+
frontMatter: typeof frontMatter;
|
|
5
|
+
comment: (comment: string) => string;
|
|
6
|
+
horizontalRule: "---";
|
|
7
|
+
heading: typeof tsmd.heading;
|
|
8
|
+
blockquote: typeof tsmd.blockquote;
|
|
9
|
+
orderedList: typeof tsmd.orderedList;
|
|
10
|
+
list: typeof tsmd.list;
|
|
11
|
+
codeBlock: typeof tsmd.codeBlock;
|
|
12
|
+
code: typeof tsmd.code;
|
|
13
|
+
italic: typeof tsmd.italic;
|
|
14
|
+
bold: typeof tsmd.bold;
|
|
15
|
+
link: typeof tsmd.link;
|
|
16
|
+
image: typeof tsmd.image;
|
|
17
|
+
table: typeof tsmd.table;
|
|
18
|
+
lineBreak: "<br/>";
|
|
19
|
+
disclosure: typeof tsmd.disclosure;
|
|
20
|
+
escape: typeof tsmd.escape;
|
|
21
|
+
joinBlocks: typeof tsmd.joinBlocks;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=md.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"md.d.ts","sourceRoot":"","sources":["../../src/utils/md.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,qBAAqB,CAAC;AAG5C,iBAAS,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAM5D;AAED,eAAO,MAAM,EAAE;;uBAA8C,MAAM;;;;;;;;;;;;;;;;;CAA4B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@preply/ds-ai-core",
|
|
3
|
+
"description": "Shared AI tools for the Preply Design System",
|
|
4
|
+
"version": "11.1.0",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"clean": "rm -rf dist",
|
|
17
|
+
"check:types": "run --top-level tsc --noEmit",
|
|
18
|
+
"lint": "run --top-level eslint .",
|
|
19
|
+
"test": "run --top-level vitest --config ../../vitest.config.mts --watch=false packages/ai-core",
|
|
20
|
+
"test:watch": "run --top-level vitest --config ../../vitest.config.mts --watch=true packages/ai-core",
|
|
21
|
+
"build": "vite build",
|
|
22
|
+
"dev": "vite build --watch"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@preply/ds-core": "11.1.0",
|
|
26
|
+
"@preply/ds-theme-tokyo-ui": "11.1.0",
|
|
27
|
+
"@types/lunr": "^2.3.7",
|
|
28
|
+
"@types/node": "^24.12.0",
|
|
29
|
+
"front-matter": "^4.0.2",
|
|
30
|
+
"react-docgen-typescript": "^2.4.0",
|
|
31
|
+
"unplugin-macros": "^0.19.1",
|
|
32
|
+
"vite": "^8.0.0",
|
|
33
|
+
"vite-plugin-dts": "^4.5.4"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"dedent": "^1.7.0",
|
|
37
|
+
"env-paths": "^2.2.1",
|
|
38
|
+
"glob": "^13.0.0",
|
|
39
|
+
"kebab-case": "^2.0.2",
|
|
40
|
+
"lunr": "^2.3.9",
|
|
41
|
+
"posthog-node": "^5.28.6",
|
|
42
|
+
"ts-markdown-builder": "^0.5.0",
|
|
43
|
+
"yaml": "^2.8.1",
|
|
44
|
+
"zod": "^3.23.8",
|
|
45
|
+
"zod-opts": "^1.0.0"
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "a5330f56c6c03a557b29efefcabacb41d67f4b63"
|
|
48
|
+
}
|