@ethlete/agent-rules 0.1.0-next.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/CHANGELOG.md +23 -0
- package/README.md +106 -0
- package/content/defaults.json +10 -0
- package/content/rules/comments.md +31 -0
- package/content/rules/lint-and-format.md +26 -0
- package/content/rules/reactive-state.md +15 -0
- package/content/rules/styling.md +35 -0
- package/content/skills/angular-patterns/SKILL.md +60 -0
- package/content/skills/git-commit/SKILL.md +29 -0
- package/content/skills/handoff/SKILL.md +98 -0
- package/content/skills/query/SKILL.md +114 -0
- package/content/skills/rxjs-signals/SKILL.md +65 -0
- package/content/skills/sdk-docs/SKILL.md +70 -0
- package/content/skills/story-styling/SKILL.md +83 -0
- package/content/skills/styleguide/SKILL.md +66 -0
- package/content/skills/styleguide/STYLEGUIDE.md +520 -0
- package/content/skills/theming/SKILL.md +110 -0
- package/content/skills/verify-in-storybook/SKILL.md +78 -0
- package/content/skills/verify-in-storybook/verify-template.mjs +42 -0
- package/package.json +15 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +79 -0
- package/src/index.js.map +1 -0
- package/src/lib/config.d.ts +21 -0
- package/src/lib/config.js +54 -0
- package/src/lib/config.js.map +1 -0
- package/src/lib/filter.d.ts +16 -0
- package/src/lib/filter.js +49 -0
- package/src/lib/filter.js.map +1 -0
- package/src/lib/frontmatter.d.ts +23 -0
- package/src/lib/frontmatter.js +117 -0
- package/src/lib/frontmatter.js.map +1 -0
- package/src/lib/index.d.ts +9 -0
- package/src/lib/index.js +13 -0
- package/src/lib/index.js.map +1 -0
- package/src/lib/load-content.d.ts +19 -0
- package/src/lib/load-content.js +79 -0
- package/src/lib/load-content.js.map +1 -0
- package/src/lib/owned-paths.d.ts +7 -0
- package/src/lib/owned-paths.js +47 -0
- package/src/lib/owned-paths.js.map +1 -0
- package/src/lib/plan.d.ts +20 -0
- package/src/lib/plan.js +57 -0
- package/src/lib/plan.js.map +1 -0
- package/src/lib/render.d.ts +39 -0
- package/src/lib/render.js +73 -0
- package/src/lib/render.js.map +1 -0
- package/src/lib/sync.d.ts +9 -0
- package/src/lib/sync.js +90 -0
- package/src/lib/sync.js.map +1 -0
- package/src/lib/targets/claude.d.ts +7 -0
- package/src/lib/targets/claude.js +46 -0
- package/src/lib/targets/claude.js.map +1 -0
- package/src/lib/targets/codex.d.ts +11 -0
- package/src/lib/targets/codex.js +26 -0
- package/src/lib/targets/codex.js.map +1 -0
- package/src/lib/targets/copilot.d.ts +11 -0
- package/src/lib/targets/copilot.js +43 -0
- package/src/lib/targets/copilot.js.map +1 -0
- package/src/lib/targets/cursor.d.ts +7 -0
- package/src/lib/targets/cursor.js +35 -0
- package/src/lib/targets/cursor.js.map +1 -0
- package/src/lib/targets/neutral.d.ts +8 -0
- package/src/lib/targets/neutral.js +29 -0
- package/src/lib/targets/neutral.js.map +1 -0
- package/src/lib/targets/shared.d.ts +60 -0
- package/src/lib/targets/shared.js +50 -0
- package/src/lib/targets/shared.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../../../../../libs/agent-rules/src/lib/targets/copilot.ts"],"names":[],"mappings":";;;AAAA,sCAA4D;AAC5D,qCAUkB;AAEL,QAAA,YAAY,GAAG,iCAAiC,CAAC;AAE9D;;;;GAIG;AACI,MAAM,WAAW,GAAG,CAAC,OAAmD,EAAiB,EAAE;IAChG,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IACtC,MAAM,MAAM,GAAG,IAAA,oBAAW,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAG,IAAA,kBAAS,EAAC;QACtB,OAAO;QACP,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAA,wBAAe,EAAC,IAAI,CAAC,IAAI;QAC/C,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,IAA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,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,wBAAe,EAAE,CAAC;SACtE,CAAC,IAAI,CAAC,MAAM,CAAC,CACf,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,IAAA,iBAAQ,EAAC,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAExD,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,oBAAY,EAAE,QAAQ,EAAE,IAAA,2BAAkB,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAEtF,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAvCW,QAAA,WAAW,eAuCtB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EmitContext, EmittedFile } from './shared';
|
|
2
|
+
/**
|
|
3
|
+
* Cursor has no bundle concept, so a skill's resource files stay in the neutral `.agents/ethlete/`
|
|
4
|
+
* tree and the rule points at them. Rules apply always; skills are "agent requested" — Cursor picks
|
|
5
|
+
* them from the description, or attaches them automatically when `globs` match the open file.
|
|
6
|
+
*/
|
|
7
|
+
export declare const emitCursor: (context: EmitContext) => EmittedFile[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emitCursor = void 0;
|
|
4
|
+
const render_1 = require("../render");
|
|
5
|
+
const shared_1 = require("./shared");
|
|
6
|
+
/**
|
|
7
|
+
* Cursor has no bundle concept, so a skill's resource files stay in the neutral `.agents/ethlete/`
|
|
8
|
+
* tree and the rule points at them. Rules apply always; skills are "agent requested" — Cursor picks
|
|
9
|
+
* them from the description, or attaches them automatically when `globs` match the open file.
|
|
10
|
+
*/
|
|
11
|
+
const emitCursor = (context) => {
|
|
12
|
+
const banner = (0, render_1.buildBanner)(context.version);
|
|
13
|
+
const links = (0, shared_1.makeLinks)({
|
|
14
|
+
context,
|
|
15
|
+
skill: (name) => `the **\`ethlete-${name}\`** rule`,
|
|
16
|
+
resource: (target) => `\`${(0, shared_1.neutralResourcePath)(target)}\``,
|
|
17
|
+
});
|
|
18
|
+
const emit = (options) => options.items.map((item) => {
|
|
19
|
+
const { name, paths } = item.frontmatter;
|
|
20
|
+
const frontmatter = [
|
|
21
|
+
'---',
|
|
22
|
+
`description: ${(0, shared_1.yamlString)((0, shared_1.description)({ item, context }))}`,
|
|
23
|
+
paths.length > 0 ? `globs: ${paths.join(',')}` : 'globs:',
|
|
24
|
+
`alwaysApply: ${options.alwaysApply}`,
|
|
25
|
+
'---',
|
|
26
|
+
].join('\n');
|
|
27
|
+
return {
|
|
28
|
+
path: `.cursor/rules/ethlete-${name}.mdc`,
|
|
29
|
+
contents: (0, shared_1.document)([frontmatter, banner, (0, shared_1.body)({ item, context, links })]),
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
return [...emit({ items: context.rules, alwaysApply: true }), ...emit({ items: context.skills, alwaysApply: false })];
|
|
33
|
+
};
|
|
34
|
+
exports.emitCursor = emitCursor;
|
|
35
|
+
//# sourceMappingURL=cursor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../../../../../libs/agent-rules/src/lib/targets/cursor.ts"],"names":[],"mappings":";;;AAAA,sCAAwC;AACxC,qCASkB;AAElB;;;;GAIG;AACI,MAAM,UAAU,GAAG,CAAC,OAAoB,EAAiB,EAAE;IAChE,MAAM,MAAM,GAAG,IAAA,oBAAW,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAG,IAAA,kBAAS,EAAC;QACtB,OAAO;QACP,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,mBAAmB,IAAI,WAAW;QACnD,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,IAAA,4BAAmB,EAAC,MAAM,CAAC,IAAI;KAC3D,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,CAAC,OAA8D,EAAE,EAAE,CAC9E,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC;QACzC,MAAM,WAAW,GAAG;YAClB,KAAK;YACL,gBAAgB,IAAA,mBAAU,EAAC,IAAA,oBAAW,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE;YAC5D,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;YACzD,gBAAgB,OAAO,CAAC,WAAW,EAAE;YACrC,KAAK;SACN,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEb,OAAO;YACL,IAAI,EAAE,yBAAyB,IAAI,MAAM;YACzC,QAAQ,EAAE,IAAA,iBAAQ,EAAC,CAAC,WAAW,EAAE,MAAM,EAAE,IAAA,aAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;SAC1E,CAAC;IACJ,CAAC,CAAC,CAAC;IAEL,OAAO,CAAC,GAAG,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AACxH,CAAC,CAAC;AA1BW,QAAA,UAAU,cA0BrB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EmitContext, EmittedFile } from './shared';
|
|
2
|
+
/**
|
|
3
|
+
* Plain markdown copies under `.agents/ethlete/`, with no agent-specific frontmatter. Codex,
|
|
4
|
+
* Cursor and Copilot all point at these for anything their own format cannot express — Codex has
|
|
5
|
+
* no on-demand mechanism at all, and neither Cursor nor Copilot can bundle a resource file
|
|
6
|
+
* alongside a rule.
|
|
7
|
+
*/
|
|
8
|
+
export declare const emitNeutral: (context: EmitContext) => EmittedFile[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emitNeutral = void 0;
|
|
4
|
+
const render_1 = require("../render");
|
|
5
|
+
const shared_1 = require("./shared");
|
|
6
|
+
/**
|
|
7
|
+
* Plain markdown copies under `.agents/ethlete/`, with no agent-specific frontmatter. Codex,
|
|
8
|
+
* Cursor and Copilot all point at these for anything their own format cannot express — Codex has
|
|
9
|
+
* no on-demand mechanism at all, and neither Cursor nor Copilot can bundle a resource file
|
|
10
|
+
* alongside a rule.
|
|
11
|
+
*/
|
|
12
|
+
const emitNeutral = (context) => {
|
|
13
|
+
const banner = (0, render_1.buildBanner)(context.version);
|
|
14
|
+
const files = [];
|
|
15
|
+
for (const item of context.skills) {
|
|
16
|
+
files.push({
|
|
17
|
+
path: (0, shared_1.neutralBodyPath)(item.frontmatter.name),
|
|
18
|
+
contents: (0, shared_1.document)([banner, (0, shared_1.body)({ item, context, links: (0, shared_1.neutralLinks)(context) })]),
|
|
19
|
+
});
|
|
20
|
+
files.push(...(0, shared_1.resourceFiles)({
|
|
21
|
+
item,
|
|
22
|
+
context,
|
|
23
|
+
pathFor: (fileName) => (0, shared_1.neutralResourcePath)({ skillName: item.frontmatter.name, fileName }),
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
return files;
|
|
27
|
+
};
|
|
28
|
+
exports.emitNeutral = emitNeutral;
|
|
29
|
+
//# sourceMappingURL=neutral.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"neutral.js","sourceRoot":"","sources":["../../../../../../libs/agent-rules/src/lib/targets/neutral.ts"],"names":[],"mappings":";;;AAAA,sCAAwC;AACxC,qCASkB;AAElB;;;;;GAKG;AACI,MAAM,WAAW,GAAG,CAAC,OAAoB,EAAiB,EAAE;IACjE,MAAM,MAAM,GAAG,IAAA,oBAAW,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAkB,EAAE,CAAC;IAEhC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QAClC,KAAK,CAAC,IAAI,CAAC;YACT,IAAI,EAAE,IAAA,wBAAe,EAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;YAC5C,QAAQ,EAAE,IAAA,iBAAQ,EAAC,CAAC,MAAM,EAAE,IAAA,aAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAA,qBAAY,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;SACpF,CAAC,CAAC;QAEH,KAAK,CAAC,IAAI,CACR,GAAG,IAAA,sBAAa,EAAC;YACf,IAAI;YACJ,OAAO;YACP,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAA,4BAAmB,EAAC,EAAE,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC;SAC3F,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AApBW,QAAA,WAAW,eAoBtB"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ContentItem } from '../load-content';
|
|
2
|
+
import { LinkResolver } from '../render';
|
|
3
|
+
export type EmittedFile = {
|
|
4
|
+
/** Path relative to the consumer repo root, always with forward slashes. */
|
|
5
|
+
path: string;
|
|
6
|
+
contents: string;
|
|
7
|
+
};
|
|
8
|
+
export type EmitContext = {
|
|
9
|
+
rules: ContentItem[];
|
|
10
|
+
skills: ContentItem[];
|
|
11
|
+
/** Names of the skills that actually survived filtering, so links can't point at a missing file. */
|
|
12
|
+
emittedSkills: Set<string>;
|
|
13
|
+
vars: Record<string, string | string[]>;
|
|
14
|
+
version: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const NEUTRAL_DIR = ".agents/ethlete";
|
|
17
|
+
export declare const neutralBodyPath: (name: string) => string;
|
|
18
|
+
export declare const neutralResourcePath: (options: {
|
|
19
|
+
skillName: string;
|
|
20
|
+
fileName: string;
|
|
21
|
+
}) => string;
|
|
22
|
+
/**
|
|
23
|
+
* A guide can be filtered out of a given repo while another still references it. Degrade such a
|
|
24
|
+
* link to the bare name rather than emitting a path to a file that was never written.
|
|
25
|
+
*/
|
|
26
|
+
export declare const makeLinks: (options: {
|
|
27
|
+
context: EmitContext;
|
|
28
|
+
skill: (name: string) => string;
|
|
29
|
+
resource: (target: {
|
|
30
|
+
skillName: string;
|
|
31
|
+
fileName: string;
|
|
32
|
+
}) => string;
|
|
33
|
+
}) => LinkResolver;
|
|
34
|
+
export declare const neutralLinks: (context: EmitContext) => LinkResolver;
|
|
35
|
+
export declare const body: (options: {
|
|
36
|
+
item: ContentItem;
|
|
37
|
+
context: EmitContext;
|
|
38
|
+
links: LinkResolver;
|
|
39
|
+
}) => string;
|
|
40
|
+
export declare const description: (options: {
|
|
41
|
+
item: ContentItem;
|
|
42
|
+
context: EmitContext;
|
|
43
|
+
}) => string;
|
|
44
|
+
export declare const resourceFiles: (options: {
|
|
45
|
+
item: ContentItem;
|
|
46
|
+
context: EmitContext;
|
|
47
|
+
pathFor: (fileName: string) => string;
|
|
48
|
+
}) => {
|
|
49
|
+
path: string;
|
|
50
|
+
contents: string;
|
|
51
|
+
}[];
|
|
52
|
+
/** Descriptions routinely contain `:` and `-`, so always quote them rather than guess. */
|
|
53
|
+
export declare const yamlString: (value: string) => string;
|
|
54
|
+
/** Every generated document ends with exactly one trailing newline so Prettier stays quiet. */
|
|
55
|
+
export declare const document: (parts: string[]) => string;
|
|
56
|
+
export declare const pointerTable: (options: {
|
|
57
|
+
skills: ContentItem[];
|
|
58
|
+
context: EmitContext;
|
|
59
|
+
pathFor: (name: string) => string;
|
|
60
|
+
}) => string;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pointerTable = exports.document = exports.yamlString = exports.resourceFiles = exports.description = exports.body = exports.neutralLinks = exports.makeLinks = exports.neutralResourcePath = exports.neutralBodyPath = exports.NEUTRAL_DIR = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const render_1 = require("../render");
|
|
6
|
+
exports.NEUTRAL_DIR = '.agents/ethlete';
|
|
7
|
+
const neutralBodyPath = (name) => `${exports.NEUTRAL_DIR}/${name}.md`;
|
|
8
|
+
exports.neutralBodyPath = neutralBodyPath;
|
|
9
|
+
const neutralResourcePath = (options) => `${exports.NEUTRAL_DIR}/${options.skillName}/${options.fileName}`;
|
|
10
|
+
exports.neutralResourcePath = neutralResourcePath;
|
|
11
|
+
/**
|
|
12
|
+
* A guide can be filtered out of a given repo while another still references it. Degrade such a
|
|
13
|
+
* link to the bare name rather than emitting a path to a file that was never written.
|
|
14
|
+
*/
|
|
15
|
+
const makeLinks = (options) => ({
|
|
16
|
+
skill: (name) => (options.context.emittedSkills.has(name) ? options.skill(name) : `\`${name}\``),
|
|
17
|
+
resource: options.resource,
|
|
18
|
+
});
|
|
19
|
+
exports.makeLinks = makeLinks;
|
|
20
|
+
const neutralLinks = (context) => (0, exports.makeLinks)({
|
|
21
|
+
context,
|
|
22
|
+
skill: (name) => `\`${(0, exports.neutralBodyPath)(name)}\``,
|
|
23
|
+
resource: (target) => `\`${(0, exports.neutralResourcePath)(target)}\``,
|
|
24
|
+
});
|
|
25
|
+
exports.neutralLinks = neutralLinks;
|
|
26
|
+
const body = (options) => (0, render_1.renderBody)({ item: options.item, vars: options.context.vars, links: options.links });
|
|
27
|
+
exports.body = body;
|
|
28
|
+
const description = (options) => (0, render_1.renderDescription)({ item: options.item, vars: options.context.vars });
|
|
29
|
+
exports.description = description;
|
|
30
|
+
const resourceFiles = (options) => options.item.resources.map((resource) => ({
|
|
31
|
+
path: options.pathFor(resource.fileName),
|
|
32
|
+
contents: (0, render_1.substituteVars)({
|
|
33
|
+
text: (0, fs_1.readFileSync)(resource.absolutePath, 'utf8'),
|
|
34
|
+
vars: options.context.vars,
|
|
35
|
+
origin: `${options.item.frontmatter.name}/${resource.fileName}`,
|
|
36
|
+
}),
|
|
37
|
+
}));
|
|
38
|
+
exports.resourceFiles = resourceFiles;
|
|
39
|
+
/** Descriptions routinely contain `:` and `-`, so always quote them rather than guess. */
|
|
40
|
+
const yamlString = (value) => `"${value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
|
41
|
+
exports.yamlString = yamlString;
|
|
42
|
+
/** Every generated document ends with exactly one trailing newline so Prettier stays quiet. */
|
|
43
|
+
const document = (parts) => `${parts.filter((part) => part.length > 0).join('\n\n')}\n`;
|
|
44
|
+
exports.document = document;
|
|
45
|
+
const pointerTable = (options) => {
|
|
46
|
+
const rows = options.skills.map((item) => `| \`${options.pathFor(item.frontmatter.name)}\` | ${(0, exports.description)({ item, context: options.context })} |`);
|
|
47
|
+
return ['| Read this file | When |', '| --- | --- |', ...rows].join('\n');
|
|
48
|
+
};
|
|
49
|
+
exports.pointerTable = pointerTable;
|
|
50
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../../libs/agent-rules/src/lib/targets/shared.ts"],"names":[],"mappings":";;;AAAA,2BAAkC;AAElC,sCAAwF;AAiB3E,QAAA,WAAW,GAAG,iBAAiB,CAAC;AAEtC,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,GAAG,mBAAW,IAAI,IAAI,KAAK,CAAC;AAAhE,QAAA,eAAe,mBAAiD;AAEtE,MAAM,mBAAmB,GAAG,CAAC,OAAgD,EAAE,EAAE,CACtF,GAAG,mBAAW,IAAI,OAAO,CAAC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