@open-agent-toolkit/cli 0.1.74 → 0.1.76
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/assets/docs/cli-utilities/configuration.md +18 -12
- package/assets/docs/provider-sync/commands.md +26 -0
- package/assets/docs/provider-sync/config.md +17 -6
- package/assets/docs/provider-sync/index.md +17 -5
- package/assets/docs/provider-sync/manifest-and-drift.md +39 -1
- package/assets/docs/provider-sync/providers.md +8 -2
- package/assets/docs/provider-sync/scope-and-surface.md +5 -1
- package/assets/docs/reference/file-locations.md +9 -3
- package/assets/docs/reference/oat-directory-structure.md +11 -3
- package/assets/docs/reference/troubleshooting.md +11 -0
- package/assets/public-package-versions.json +4 -4
- package/assets/skills/create-agnostic-skill/SKILL.md +1 -1
- package/assets/skills/create-agnostic-skill/references/docs/skills-guide.md +24 -15
- package/assets/skills/oat-agent-instructions-analyze/references/docs/provider-reference.md +9 -3
- package/assets/skills/oat-agent-instructions-apply/references/docs/provider-reference.md +9 -3
- package/dist/commands/config/index.d.ts.map +1 -1
- package/dist/commands/config/index.js +55 -0
- package/dist/commands/init/index.d.ts +6 -2
- package/dist/commands/init/index.d.ts.map +1 -1
- package/dist/commands/init/index.js +90 -31
- package/dist/commands/remove/skill/remove-skill.d.ts +2 -0
- package/dist/commands/remove/skill/remove-skill.d.ts.map +1 -1
- package/dist/commands/remove/skill/remove-skill.js +20 -2
- package/dist/commands/shared/adopt-stray.d.ts.map +1 -1
- package/dist/commands/shared/adopt-stray.js +3 -0
- package/dist/commands/shared/cursor-skill-disposition.d.ts +17 -0
- package/dist/commands/shared/cursor-skill-disposition.d.ts.map +1 -0
- package/dist/commands/shared/cursor-skill-disposition.js +41 -0
- package/dist/commands/status/index.d.ts +10 -4
- package/dist/commands/status/index.d.ts.map +1 -1
- package/dist/commands/status/index.js +99 -31
- package/dist/config/oat-config.d.ts +0 -1
- package/dist/config/oat-config.d.ts.map +1 -1
- package/dist/config/oat-config.js +26 -23
- package/dist/config/sync-config.d.ts +6 -2
- package/dist/config/sync-config.d.ts.map +1 -1
- package/dist/config/sync-config.js +18 -6
- package/dist/config/user-sync-config.d.ts +11 -0
- package/dist/config/user-sync-config.d.ts.map +1 -0
- package/dist/config/user-sync-config.js +61 -0
- package/dist/drift/strays.d.ts +1 -1
- package/dist/drift/strays.d.ts.map +1 -1
- package/dist/drift/strays.js +2 -1
- package/dist/engine/compute-plan.d.ts.map +1 -1
- package/dist/engine/compute-plan.js +154 -4
- package/dist/engine/engine.types.d.ts +2 -2
- package/dist/engine/engine.types.d.ts.map +1 -1
- package/dist/engine/engine.types.js +1 -0
- package/dist/engine/execute-plan.d.ts.map +1 -1
- package/dist/engine/execute-plan.js +4 -0
- package/dist/manifest/manifest.types.d.ts +12 -12
- package/dist/providers/cursor/paths.d.ts.map +1 -1
- package/dist/providers/cursor/paths.js +6 -4
- package/dist/providers/shared/adapter.types.d.ts +6 -0
- package/dist/providers/shared/adapter.types.d.ts.map +1 -1
- package/dist/providers/shared/adapter.utils.d.ts +2 -1
- package/dist/providers/shared/adapter.utils.d.ts.map +1 -1
- package/dist/providers/shared/adapter.utils.js +29 -6
- package/package.json +2 -2
|
@@ -565,6 +565,17 @@ const CONFIG_CATALOG = [
|
|
|
565
565
|
owningCommand: 'oat providers set --scope project',
|
|
566
566
|
description: 'Default sync strategy used when a provider does not override its own strategy.',
|
|
567
567
|
},
|
|
568
|
+
{
|
|
569
|
+
key: 'sync.knownStrays',
|
|
570
|
+
group: 'Sync/Provider (.oat/sync/config.json)',
|
|
571
|
+
file: '.oat/sync/config.json',
|
|
572
|
+
scope: 'project sync',
|
|
573
|
+
type: 'string[]',
|
|
574
|
+
defaultValue: '[]',
|
|
575
|
+
mutability: 'managed',
|
|
576
|
+
owningCommand: 'oat init / oat status',
|
|
577
|
+
description: 'Exact normalized provider-local paths intentionally kept outside the canonical project inventory.',
|
|
578
|
+
},
|
|
568
579
|
{
|
|
569
580
|
key: 'sync.providers.<name>.enabled',
|
|
570
581
|
group: 'Sync/Provider (.oat/sync/config.json)',
|
|
@@ -587,6 +598,50 @@ const CONFIG_CATALOG = [
|
|
|
587
598
|
owningCommand: 'oat providers set --scope project',
|
|
588
599
|
description: 'Provider-specific sync strategy override for a named provider.',
|
|
589
600
|
},
|
|
601
|
+
{
|
|
602
|
+
key: 'sync.defaultStrategy',
|
|
603
|
+
group: 'User Sync (~/.oat/sync/config.json)',
|
|
604
|
+
file: '~/.oat/sync/config.json',
|
|
605
|
+
scope: 'user sync',
|
|
606
|
+
type: 'auto | symlink | copy',
|
|
607
|
+
defaultValue: 'auto',
|
|
608
|
+
mutability: 'read/write',
|
|
609
|
+
owningCommand: 'oat providers set --scope user',
|
|
610
|
+
description: 'Default user-scope sync strategy used when a provider does not override its own strategy.',
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
key: 'sync.knownStrays',
|
|
614
|
+
group: 'User Sync (~/.oat/sync/config.json)',
|
|
615
|
+
file: '~/.oat/sync/config.json',
|
|
616
|
+
scope: 'user sync',
|
|
617
|
+
type: 'string[]',
|
|
618
|
+
defaultValue: '[]',
|
|
619
|
+
mutability: 'managed',
|
|
620
|
+
owningCommand: 'oat init / oat status',
|
|
621
|
+
description: 'Exact normalized user provider-local paths intentionally kept outside the canonical user inventory.',
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
key: 'sync.providers.<name>.enabled',
|
|
625
|
+
group: 'User Sync (~/.oat/sync/config.json)',
|
|
626
|
+
file: '~/.oat/sync/config.json',
|
|
627
|
+
scope: 'user sync',
|
|
628
|
+
type: 'boolean',
|
|
629
|
+
defaultValue: 'unset',
|
|
630
|
+
mutability: 'read/write',
|
|
631
|
+
owningCommand: 'oat providers set --scope user --enabled/--disabled',
|
|
632
|
+
description: 'Provider-specific enablement for user sync surfaces.',
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
key: 'sync.providers.<name>.strategy',
|
|
636
|
+
group: 'User Sync (~/.oat/sync/config.json)',
|
|
637
|
+
file: '~/.oat/sync/config.json',
|
|
638
|
+
scope: 'user sync',
|
|
639
|
+
type: 'auto | symlink | copy',
|
|
640
|
+
defaultValue: 'inherit sync.defaultStrategy',
|
|
641
|
+
mutability: 'read/write',
|
|
642
|
+
owningCommand: 'oat providers set --scope user',
|
|
643
|
+
description: 'Provider-specific user sync strategy override for a named provider.',
|
|
644
|
+
},
|
|
590
645
|
];
|
|
591
646
|
const DEFAULT_DEPENDENCIES = {
|
|
592
647
|
buildCommandContext,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type CommandContext, type GlobalOptions } from '../../app/command-context.js';
|
|
2
2
|
import { type ApplyOatCoreResult } from '../init/gitignore.js';
|
|
3
|
+
import { type CursorSkillDisposition } from '../shared/cursor-skill-disposition.js';
|
|
3
4
|
import { type MultiSelectChoice, type PromptContext, type SelectChoice } from '../shared/shared.prompts.js';
|
|
4
5
|
import { type SyncConfig } from '../../config/index.js';
|
|
5
|
-
import { type OatConfig
|
|
6
|
+
import { type OatConfig } from '../../config/oat-config.js';
|
|
6
7
|
import { type DriftReport } from '../../drift/index.js';
|
|
7
8
|
import { type CanonicalEntry, type HookInstallInfo } from '../../engine/index.js';
|
|
8
9
|
import type { Manifest } from '../../manifest/manifest.types.js';
|
|
@@ -42,7 +43,7 @@ interface InitDependencies {
|
|
|
42
43
|
uninstallHook: (projectRoot: string) => Promise<void>;
|
|
43
44
|
getAdapters: () => ProviderAdapter[];
|
|
44
45
|
loadSyncConfig: (configPath: string) => Promise<SyncConfig>;
|
|
45
|
-
|
|
46
|
+
resolveUserSyncConfig: (userConfigDir: string) => Promise<SyncConfig>;
|
|
46
47
|
saveSyncConfig: (configPath: string, config: SyncConfig) => Promise<SyncConfig>;
|
|
47
48
|
getConfigAwareAdapters: (adapters: ProviderAdapter[], scopeRoot: string, config: SyncConfig) => Promise<ConfigAwareAdaptersResult>;
|
|
48
49
|
applyOatCoreGitignore: (repoRoot: string) => Promise<ApplyOatCoreResult>;
|
|
@@ -62,6 +63,9 @@ interface InitDependencies {
|
|
|
62
63
|
fileExists: (path: string) => Promise<boolean>;
|
|
63
64
|
inputWithDefault: (message: string, defaultValue: string, ctx: PromptContext) => Promise<string | null>;
|
|
64
65
|
selectWithAbort: <T extends string>(message: string, choices: SelectChoice<T>[], ctx: PromptContext) => Promise<T | null>;
|
|
66
|
+
applyCursorSkillDisposition: (scopeRoot: string, stray: InitStrayCandidate, manifest: Manifest, disposition: CursorSkillDisposition, syncConfigPath: string, options?: {
|
|
67
|
+
replaceCanonical?: boolean;
|
|
68
|
+
}) => Promise<Manifest>;
|
|
65
69
|
runGuidedSetup: (context: CommandContext, dependencies: InitDependencies) => Promise<void>;
|
|
66
70
|
runToolPacks: (context: CommandContext) => Promise<ToolPack[]>;
|
|
67
71
|
runProviderSync: (projectRoot: string) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EAEnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,kBAAkB,EAExB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EAEnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,kBAAkB,EAExB,MAAM,0BAA0B,CAAC;AAYlC,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,2CAA2C,CAAC;AAGnD,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,YAAY,EAGlB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,EAGL,KAAK,UAAU,EAEhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,KAAK,SAAS,EAKf,MAAM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AAC;IAC/D,eAAe,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD;AAq8BD,wBAAgB,iBAAiB,CAC/B,SAAS,GAAE,OAAO,CAAC,gBAAgB,CAAM,GACxC,OAAO,CAiBT"}
|
|
@@ -7,12 +7,14 @@ import { applyGitignore } from '../local/apply.js';
|
|
|
7
7
|
import { addLocalPaths } from '../local/manage.js';
|
|
8
8
|
import { adoptStrayToCanonical, isAdoptionConflictError, } from '../shared/adopt-stray.js';
|
|
9
9
|
import { detectCodexRoleStrays, filterMaterializationManagedStrays, regenerateCodexAfterAdoption, } from '../shared/codex-strays.js';
|
|
10
|
+
import { applyCursorSkillDisposition, isCursorSkillCandidate, } from '../shared/cursor-skill-disposition.js';
|
|
10
11
|
import { PROVIDER_CONFIG_REMEDIATION } from '../shared/messages.js';
|
|
11
12
|
import { withScopeOption } from '../shared/scope-option.js';
|
|
12
13
|
import { confirmAction, inputWithDefault, selectManyWithAbort, selectWithAbort, } from '../shared/shared.prompts.js';
|
|
13
14
|
import { readGlobalOptions, resolveConcreteScopes, } from '../shared/shared.utils.js';
|
|
14
15
|
import { DEFAULT_SYNC_CONFIG, loadSyncConfig, saveSyncConfig, } from '../../config/index.js';
|
|
15
|
-
import { detectDefaultBranch,
|
|
16
|
+
import { detectDefaultBranch, readOatConfig, resolveLocalPaths, writeOatConfig, } from '../../config/oat-config.js';
|
|
17
|
+
import { resolveUserSyncConfig } from '../../config/user-sync-config.js';
|
|
16
18
|
import { detectStrays, filterKnownStrays, } from '../../drift/index.js';
|
|
17
19
|
import { configureLocalHooksPath, getHookInstallInfo, installHook, isHookInstalled, scanBundledManagedAgents, scanCanonical, uninstallHook, } from '../../engine/index.js';
|
|
18
20
|
import { dirExists, fileExists } from '../../fs/io.js';
|
|
@@ -26,7 +28,8 @@ import { copilotAdapter } from '../../providers/copilot/index.js';
|
|
|
26
28
|
import { cursorAdapter } from '../../providers/cursor/index.js';
|
|
27
29
|
import { applyCursorProjectExtensionPlan, computeCursorProjectExtensionPlan, } from '../../providers/cursor/codec/sync-extension.js';
|
|
28
30
|
import { geminiAdapter } from '../../providers/gemini/index.js';
|
|
29
|
-
import { getActiveAdapters, getConfigAwareAdapters,
|
|
31
|
+
import { getActiveAdapters, getConfigAwareAdapters, } from '../../providers/shared/index.js';
|
|
32
|
+
import { getAdoptionSources } from '../../providers/shared/adapter.utils.js';
|
|
30
33
|
import { Command } from 'commander';
|
|
31
34
|
import { detectExistingDocs, } from './detect-docs.js';
|
|
32
35
|
import { createInitToolsCommand, runInitToolsWithDefaults, } from './tools/index.js';
|
|
@@ -83,10 +86,10 @@ async function collectStraysDefault(scopeRoot, scope, manifest, canonicalEntries
|
|
|
83
86
|
...(cursorExtensionPlan ? [cursorExtensionPlan] : []),
|
|
84
87
|
];
|
|
85
88
|
for (const adapter of adaptersToScan) {
|
|
86
|
-
const
|
|
87
|
-
for (const
|
|
88
|
-
const providerDir = join(scopeRoot,
|
|
89
|
-
const strays = filterMaterializationManagedStrays((await detectStrays(adapter.name, providerDir, manifest, canonicalEntries, mapping)).map((report) => ({ provider: adapter.name, report })), materializationPlans).map((candidate) => candidate.report);
|
|
89
|
+
const adoptionSources = getAdoptionSources(adapter, scope);
|
|
90
|
+
for (const source of adoptionSources) {
|
|
91
|
+
const providerDir = join(scopeRoot, source.directory);
|
|
92
|
+
const strays = filterMaterializationManagedStrays((await detectStrays(adapter.name, providerDir, manifest, canonicalEntries, source.mapping)).map((report) => ({ provider: adapter.name, report })), materializationPlans).map((candidate) => candidate.report);
|
|
90
93
|
for (const report of strays) {
|
|
91
94
|
if (report.state.status !== 'stray') {
|
|
92
95
|
continue;
|
|
@@ -94,7 +97,7 @@ async function collectStraysDefault(scopeRoot, scope, manifest, canonicalEntries
|
|
|
94
97
|
candidates.push({
|
|
95
98
|
provider: adapter.name,
|
|
96
99
|
report,
|
|
97
|
-
mapping,
|
|
100
|
+
mapping: source.mapping,
|
|
98
101
|
});
|
|
99
102
|
}
|
|
100
103
|
}
|
|
@@ -158,7 +161,7 @@ function createDependencies() {
|
|
|
158
161
|
async loadSyncConfig(configPath) {
|
|
159
162
|
return loadSyncConfig(configPath, DEFAULT_SYNC_CONFIG);
|
|
160
163
|
},
|
|
161
|
-
|
|
164
|
+
resolveUserSyncConfig,
|
|
162
165
|
saveSyncConfig,
|
|
163
166
|
getConfigAwareAdapters,
|
|
164
167
|
applyOatCoreGitignore,
|
|
@@ -173,6 +176,7 @@ function createDependencies() {
|
|
|
173
176
|
fileExists,
|
|
174
177
|
inputWithDefault,
|
|
175
178
|
selectWithAbort,
|
|
179
|
+
applyCursorSkillDisposition,
|
|
176
180
|
runGuidedSetup: runGuidedSetupImpl,
|
|
177
181
|
runToolPacks: runInitToolsWithDefaults,
|
|
178
182
|
async runProviderSync(projectRoot) {
|
|
@@ -454,12 +458,13 @@ async function runInitCommand(context, dependencies, hookFlag, setupFlag) {
|
|
|
454
458
|
let projectRoot = null;
|
|
455
459
|
let oatDirExistedBefore = true;
|
|
456
460
|
const scopeSummaries = [];
|
|
461
|
+
let migrationAborted = false;
|
|
457
462
|
for (const scope of scopes) {
|
|
458
463
|
const scopeRoot = await dependencies.resolveScopeRoot(scope, context);
|
|
459
464
|
const syncConfigPath = join(scopeRoot, '.oat', 'sync', 'config.json');
|
|
460
465
|
const userConfigDir = join(context.home, '.oat');
|
|
461
466
|
let syncConfig = await dependencies.loadSyncConfig(syncConfigPath);
|
|
462
|
-
const
|
|
467
|
+
const userSyncConfig = await dependencies.resolveUserSyncConfig(userConfigDir);
|
|
463
468
|
let activeAdaptersForStrays;
|
|
464
469
|
if (scope === 'project') {
|
|
465
470
|
projectRoot = scopeRoot;
|
|
@@ -514,45 +519,99 @@ async function runInitCommand(context, dependencies, hookFlag, setupFlag) {
|
|
|
514
519
|
candidates: collectedStrays,
|
|
515
520
|
knownStrays: {
|
|
516
521
|
project: syncConfig.knownStrays,
|
|
517
|
-
user:
|
|
522
|
+
user: userSyncConfig.knownStrays,
|
|
518
523
|
},
|
|
519
524
|
});
|
|
520
525
|
let straysAdopted = 0;
|
|
526
|
+
let codexStrayAdopted = false;
|
|
527
|
+
const cursorSkillStrays = strays.filter(isCursorSkillCandidate);
|
|
528
|
+
const ordinaryStrays = strays.filter((stray) => !isCursorSkillCandidate(stray));
|
|
521
529
|
if (!context.interactive && strays.length > 0) {
|
|
522
530
|
context.logger.warn(ADOPT_REMEDIATION);
|
|
523
531
|
}
|
|
524
|
-
if (context.interactive && strays.length > 0) {
|
|
525
|
-
const
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
532
|
+
if (context.interactive && strays.length > 0 && !migrationAborted) {
|
|
533
|
+
for (const stray of cursorSkillStrays) {
|
|
534
|
+
const disposition = await dependencies.selectWithAbort(`Migrate Cursor skill [${scope}]: ${formatPathForScope(scope, stray.report.providerPath)}`, [
|
|
535
|
+
{
|
|
536
|
+
label: 'Adopt into canonical',
|
|
537
|
+
value: 'adopt',
|
|
538
|
+
description: `Move to ${stray.mapping.canonicalDir}.`,
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
label: 'Keep Cursor-only',
|
|
542
|
+
value: 'keep',
|
|
543
|
+
description: 'Leave in .cursor/skills and remember this choice.',
|
|
544
|
+
},
|
|
545
|
+
], { interactive: context.interactive });
|
|
546
|
+
if (disposition === null) {
|
|
547
|
+
migrationAborted = true;
|
|
548
|
+
break;
|
|
536
549
|
}
|
|
537
550
|
try {
|
|
538
|
-
manifest = await dependencies.
|
|
539
|
-
|
|
540
|
-
|
|
551
|
+
manifest = await dependencies.applyCursorSkillDisposition(scopeRoot, stray, manifest, disposition, syncConfigPath);
|
|
552
|
+
if (disposition === 'adopt') {
|
|
553
|
+
straysAdopted += 1;
|
|
554
|
+
}
|
|
555
|
+
else {
|
|
556
|
+
context.logger.success(`Kept Cursor-only [${scope}]: ${formatPathForScope(scope, stray.report.providerPath)}.`);
|
|
557
|
+
}
|
|
541
558
|
}
|
|
542
559
|
catch (error) {
|
|
543
|
-
if (
|
|
560
|
+
if (error instanceof Error &&
|
|
561
|
+
error.message.startsWith('Cannot keep ')) {
|
|
562
|
+
context.logger.warn(error.message);
|
|
563
|
+
continue;
|
|
564
|
+
}
|
|
565
|
+
if (!isAdoptionConflictError(error) || disposition !== 'adopt') {
|
|
544
566
|
throw error;
|
|
545
567
|
}
|
|
546
568
|
const shouldReplace = await dependencies.confirmAction(`Conflict detected for ${formatPathForScope(scope, stray.report.providerPath)}. Replace canonical content with stray content?`, { interactive: context.interactive });
|
|
547
569
|
if (!shouldReplace) {
|
|
548
|
-
context.logger.warn(`Skipped conflicting
|
|
570
|
+
context.logger.warn(`Skipped conflicting Cursor skill [${scope}]: ${formatPathForScope(scope, stray.report.providerPath)}`);
|
|
549
571
|
continue;
|
|
550
572
|
}
|
|
551
|
-
manifest = await dependencies.
|
|
552
|
-
replaceCanonical: true,
|
|
553
|
-
});
|
|
573
|
+
manifest = await dependencies.applyCursorSkillDisposition(scopeRoot, stray, manifest, disposition, syncConfigPath, { replaceCanonical: true });
|
|
554
574
|
straysAdopted += 1;
|
|
555
|
-
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
if (!migrationAborted && ordinaryStrays.length > 0) {
|
|
578
|
+
const selectedValues = await dependencies.selectManyWithAbort(`Select stray entries to adopt [${scope}]`, ordinaryStrays.map((stray, index) => ({
|
|
579
|
+
label: formatStrayChoiceLabel(scope, stray.report.providerPath, stray.provider),
|
|
580
|
+
value: String(index),
|
|
581
|
+
description: formatPathForScope(scope, stray.report.providerPath),
|
|
582
|
+
})), { interactive: context.interactive });
|
|
583
|
+
if (selectedValues === null) {
|
|
584
|
+
migrationAborted = true;
|
|
585
|
+
}
|
|
586
|
+
else {
|
|
587
|
+
const selectedIndices = new Set(selectedValues.map((value) => Number.parseInt(value, 10)));
|
|
588
|
+
for (const [index, stray] of ordinaryStrays.entries()) {
|
|
589
|
+
if (!selectedIndices.has(index)) {
|
|
590
|
+
continue;
|
|
591
|
+
}
|
|
592
|
+
try {
|
|
593
|
+
manifest = await dependencies.adoptStray(scopeRoot, stray, manifest);
|
|
594
|
+
straysAdopted += 1;
|
|
595
|
+
codexStrayAdopted =
|
|
596
|
+
codexStrayAdopted || stray.provider === 'codex';
|
|
597
|
+
}
|
|
598
|
+
catch (error) {
|
|
599
|
+
if (!isAdoptionConflictError(error)) {
|
|
600
|
+
throw error;
|
|
601
|
+
}
|
|
602
|
+
const shouldReplace = await dependencies.confirmAction(`Conflict detected for ${formatPathForScope(scope, stray.report.providerPath)}. Replace canonical content with stray content?`, { interactive: context.interactive });
|
|
603
|
+
if (!shouldReplace) {
|
|
604
|
+
context.logger.warn(`Skipped conflicting stray entry [${scope}]: ${formatPathForScope(scope, stray.report.providerPath)}`);
|
|
605
|
+
continue;
|
|
606
|
+
}
|
|
607
|
+
manifest = await dependencies.adoptStray(scopeRoot, stray, manifest, {
|
|
608
|
+
replaceCanonical: true,
|
|
609
|
+
});
|
|
610
|
+
straysAdopted += 1;
|
|
611
|
+
codexStrayAdopted =
|
|
612
|
+
codexStrayAdopted || stray.provider === 'codex';
|
|
613
|
+
}
|
|
614
|
+
}
|
|
556
615
|
}
|
|
557
616
|
}
|
|
558
617
|
if (codexStrayAdopted && scope === 'project') {
|
|
@@ -3,6 +3,7 @@ import { readGlobalOptions } from '../../shared/shared.utils.js';
|
|
|
3
3
|
import { type SyncConfig } from '../../../config/sync-config.js';
|
|
4
4
|
import { type Manifest } from '../../../manifest/index.js';
|
|
5
5
|
import { type ConfigAwareAdaptersResult, type PathMapping, type ProviderAdapter } from '../../../providers/shared/index.js';
|
|
6
|
+
import type { AdoptionSource } from '../../../providers/shared/adapter.types.js';
|
|
6
7
|
import type { ConcreteScope, Scope } from '../../../shared/types.js';
|
|
7
8
|
import { Command } from 'commander';
|
|
8
9
|
export interface RemoveSkillDependencies {
|
|
@@ -14,6 +15,7 @@ export interface RemoveSkillDependencies {
|
|
|
14
15
|
getAdapters: () => ProviderAdapter[];
|
|
15
16
|
getConfigAwareAdapters: (adapters: ProviderAdapter[], scopeRoot: string, config: SyncConfig) => Promise<ConfigAwareAdaptersResult>;
|
|
16
17
|
getSyncMappings: (adapter: ProviderAdapter, scope: Scope) => PathMapping[];
|
|
18
|
+
getAdoptionSources: (adapter: ProviderAdapter, scope: Scope) => AdoptionSource[];
|
|
17
19
|
pathExists: (path: string) => Promise<boolean>;
|
|
18
20
|
removeDirectory: (path: string) => Promise<void>;
|
|
19
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-skill.d.ts","sourceRoot":"","sources":["../../../../src/commands/remove/skill/remove-skill.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EACL,iBAAiB,EAElB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAEL,KAAK,QAAQ,EAGd,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EACL,KAAK,yBAAyB,EAG9B,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8BpC,MAAM,WAAW,uBAAuB;IACtC,mBAAmB,EAAE,CACnB,OAAO,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,KAC1C,cAAc,CAAC;IACpB,gBAAgB,EAAE,CAChB,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,cAAc,KACpB,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB,YAAY,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,CAAC,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AAC,CAsDlB;AAED,wBAAgB,wBAAwB,CACtC,SAAS,GAAE,OAAO,CAAC,uBAAuB,CAAM,GAC/C,OAAO,CAwCT"}
|
|
@@ -13,6 +13,7 @@ import { copilotAdapter } from '../../../providers/copilot/index.js';
|
|
|
13
13
|
import { cursorAdapter } from '../../../providers/cursor/index.js';
|
|
14
14
|
import { geminiAdapter } from '../../../providers/gemini/index.js';
|
|
15
15
|
import { getConfigAwareAdapters, getSyncMappings, } from '../../../providers/shared/index.js';
|
|
16
|
+
import { getAdoptionSources } from '../../../providers/shared/adapter.utils.js';
|
|
16
17
|
import { Command } from 'commander';
|
|
17
18
|
export function createDefaultRemoveSkillDependencies() {
|
|
18
19
|
return {
|
|
@@ -39,6 +40,7 @@ export function createDefaultRemoveSkillDependencies() {
|
|
|
39
40
|
},
|
|
40
41
|
getConfigAwareAdapters,
|
|
41
42
|
getSyncMappings,
|
|
43
|
+
getAdoptionSources,
|
|
42
44
|
async pathExists(path) {
|
|
43
45
|
return (await fileExists(path)) || (await dirExists(path));
|
|
44
46
|
},
|
|
@@ -76,10 +78,10 @@ async function buildScopePlan(scope, scopeRoot, skillName, dependencies) {
|
|
|
76
78
|
const managedProviderViews = [];
|
|
77
79
|
const unmanagedProviderViews = [];
|
|
78
80
|
for (const adapter of activeAdapters) {
|
|
79
|
-
const
|
|
81
|
+
const syncMappings = dependencies
|
|
80
82
|
.getSyncMappings(adapter, scope)
|
|
81
83
|
.filter((mapping) => mapping.contentType === 'skill');
|
|
82
|
-
for (const mapping of
|
|
84
|
+
for (const mapping of syncMappings) {
|
|
83
85
|
const relativePath = join(mapping.providerDir, skillName);
|
|
84
86
|
const absolutePath = join(scopeRoot, relativePath);
|
|
85
87
|
const hasManifestEntry = manifest.entries.some((entry) => entry.canonicalPath === canonicalRelativePath &&
|
|
@@ -101,6 +103,22 @@ async function buildScopePlan(scope, scopeRoot, skillName, dependencies) {
|
|
|
101
103
|
});
|
|
102
104
|
}
|
|
103
105
|
}
|
|
106
|
+
const syncProviderDirs = new Set(syncMappings.map((mapping) => mapping.providerDir));
|
|
107
|
+
const localAdoptionSources = dependencies
|
|
108
|
+
.getAdoptionSources(adapter, scope)
|
|
109
|
+
.filter((source) => source.contentType === 'skill' &&
|
|
110
|
+
!syncProviderDirs.has(source.directory));
|
|
111
|
+
for (const source of localAdoptionSources) {
|
|
112
|
+
const relativePath = join(source.directory, skillName);
|
|
113
|
+
const absolutePath = join(scopeRoot, relativePath);
|
|
114
|
+
if (await dependencies.pathExists(absolutePath)) {
|
|
115
|
+
unmanagedProviderViews.push({
|
|
116
|
+
provider: adapter.name,
|
|
117
|
+
absolutePath,
|
|
118
|
+
relativePath,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
104
122
|
}
|
|
105
123
|
return {
|
|
106
124
|
scope,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adopt-stray.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/adopt-stray.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAKzC,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,0BAA0B,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAGnE,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE;QACN,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,YAAY,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,UAAU,iBAAiB;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAEzE;AAWD,wBAAsB,qBAAqB,CACzC,UAAU,SAAS,sBAAsB,EAEzC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,QAAQ,EAClB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"adopt-stray.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/adopt-stray.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAKzC,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,0BAA0B,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAGnE,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE;QACN,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,YAAY,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,UAAU,iBAAiB;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAEzE;AAWD,wBAAsB,qBAAqB,CACzC,UAAU,SAAS,sBAAsB,EAEzC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,QAAQ,EAClB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,QAAQ,CAAC,CA8EnB"}
|
|
@@ -53,6 +53,9 @@ export async function adoptStrayToCanonical(scopeRoot, stray, manifest, options
|
|
|
53
53
|
else {
|
|
54
54
|
await rename(providerAbsolutePath, canonicalAbsolutePath);
|
|
55
55
|
}
|
|
56
|
+
if (stray.mapping.nativeRead) {
|
|
57
|
+
return manifest;
|
|
58
|
+
}
|
|
56
59
|
const strategy = await createSymlink(canonicalAbsolutePath, providerAbsolutePath, undefined, isFile);
|
|
57
60
|
const canonicalPath = toPosixPath(relative(scopeRoot, canonicalAbsolutePath));
|
|
58
61
|
const providerPath = toPosixPath(relative(scopeRoot, providerAbsolutePath));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Manifest } from '../../manifest/manifest.types.js';
|
|
2
|
+
import type { PathMapping } from '../../providers/shared/adapter.types.js';
|
|
3
|
+
export type CursorSkillDisposition = 'adopt' | 'keep';
|
|
4
|
+
export interface CursorSkillCandidate {
|
|
5
|
+
provider: string;
|
|
6
|
+
report: {
|
|
7
|
+
providerPath: string;
|
|
8
|
+
};
|
|
9
|
+
mapping: PathMapping;
|
|
10
|
+
}
|
|
11
|
+
interface ApplyCursorSkillDispositionOptions {
|
|
12
|
+
replaceCanonical?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function isCursorSkillCandidate(candidate: CursorSkillCandidate): boolean;
|
|
15
|
+
export declare function applyCursorSkillDisposition(scopeRoot: string, candidate: CursorSkillCandidate, manifest: Manifest, disposition: CursorSkillDisposition, syncConfigPath: string, options?: ApplyCursorSkillDispositionOptions): Promise<Manifest>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=cursor-skill-disposition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-skill-disposition.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/cursor-skill-disposition.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAInE,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,MAAM,CAAC;AAEtD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE;QACN,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,UAAU,kCAAkC;IAC1C,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,oBAAoB,GAC9B,OAAO,CAST;AAED,wBAAsB,2BAA2B,CAC/C,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,oBAAoB,EAC/B,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,sBAAsB,EACnC,cAAc,EAAE,MAAM,EACtB,OAAO,GAAE,kCAAuC,GAC/C,OAAO,CAAC,QAAQ,CAAC,CAcnB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { access } from 'node:fs/promises';
|
|
2
|
+
import { basename, relative, resolve } from 'node:path';
|
|
3
|
+
import { appendKnownStray } from '../../config/sync-config.js';
|
|
4
|
+
import { CliError } from '../../errors/index.js';
|
|
5
|
+
import { toPosixPath } from '../../fs/paths.js';
|
|
6
|
+
import { adoptStrayToCanonical } from './adopt-stray.js';
|
|
7
|
+
export function isCursorSkillCandidate(candidate) {
|
|
8
|
+
const providerPath = toPosixPath(candidate.report.providerPath);
|
|
9
|
+
return (candidate.provider === 'cursor' &&
|
|
10
|
+
candidate.mapping.contentType === 'skill' &&
|
|
11
|
+
candidate.mapping.nativeRead &&
|
|
12
|
+
(providerPath === '.cursor/skills' ||
|
|
13
|
+
providerPath.startsWith('.cursor/skills/')));
|
|
14
|
+
}
|
|
15
|
+
export async function applyCursorSkillDisposition(scopeRoot, candidate, manifest, disposition, syncConfigPath, options = {}) {
|
|
16
|
+
if (!isCursorSkillCandidate(candidate)) {
|
|
17
|
+
throw new CliError(`Cannot apply a Cursor skill disposition to ${candidate.report.providerPath}.`);
|
|
18
|
+
}
|
|
19
|
+
if (disposition === 'adopt') {
|
|
20
|
+
return adoptStrayToCanonical(scopeRoot, candidate, manifest, options);
|
|
21
|
+
}
|
|
22
|
+
await assertCursorOnlyNameAvailable(scopeRoot, candidate);
|
|
23
|
+
await appendKnownStray(syncConfigPath, candidate.report.providerPath);
|
|
24
|
+
return manifest;
|
|
25
|
+
}
|
|
26
|
+
async function assertCursorOnlyNameAvailable(scopeRoot, candidate) {
|
|
27
|
+
const canonicalPath = resolve(scopeRoot, candidate.mapping.canonicalDir, basename(candidate.report.providerPath));
|
|
28
|
+
if (!(await pathExists(canonicalPath))) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
throw new CliError(`Cannot keep ${candidate.report.providerPath} Cursor-only because canonical skill ${toPosixPath(relative(scopeRoot, canonicalPath))} has the same name. Rename one skill, then run the command again.`);
|
|
32
|
+
}
|
|
33
|
+
async function pathExists(path) {
|
|
34
|
+
try {
|
|
35
|
+
await access(path);
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { type CommandContext, type GlobalOptions } from '../../app/command-context.js';
|
|
2
2
|
import { type CodexRoleStray } from '../shared/codex-strays.js';
|
|
3
|
-
import { type
|
|
3
|
+
import { type CursorSkillDisposition } from '../shared/cursor-skill-disposition.js';
|
|
4
|
+
import { type MultiSelectChoice, type PromptContext, type SelectChoice } from '../shared/shared.prompts.js';
|
|
4
5
|
import { type SyncConfig } from '../../config/index.js';
|
|
5
|
-
import { type UserConfig } from '../../config/oat-config.js';
|
|
6
6
|
import { type CopyTransform, type DriftReport } from '../../drift/index.js';
|
|
7
7
|
import { type CanonicalEntry } from '../../engine/index.js';
|
|
8
8
|
import type { Manifest } from '../../manifest/index.js';
|
|
9
9
|
import { type CodexExtensionPlan } from '../../providers/codex/codec/sync-extension.js';
|
|
10
10
|
import { type CursorExtensionPlan } from '../../providers/cursor/codec/sync-extension.js';
|
|
11
11
|
import { type PathMapping, type ProviderAdapter } from '../../providers/shared/index.js';
|
|
12
|
+
import type { AdoptionSource } from '../../providers/shared/adapter.types.js';
|
|
12
13
|
import { type ConcreteScope, type Scope } from '../../shared/types.js';
|
|
13
14
|
import { Command } from 'commander';
|
|
14
15
|
interface StatusDependencies {
|
|
@@ -16,15 +17,16 @@ interface StatusDependencies {
|
|
|
16
17
|
resolveScopeRoot: (scope: ConcreteScope, context: CommandContext) => Promise<string>;
|
|
17
18
|
loadManifest: (manifestPath: string) => Promise<Manifest>;
|
|
18
19
|
loadSyncConfig: (configPath: string) => Promise<SyncConfig>;
|
|
19
|
-
|
|
20
|
+
resolveUserSyncConfig: (userConfigDir: string) => Promise<SyncConfig>;
|
|
20
21
|
saveManifest: (manifestPath: string, manifest: Manifest) => Promise<void>;
|
|
21
22
|
scanCanonical: (scopeRoot: string, scope: ConcreteScope) => Promise<CanonicalEntry[]>;
|
|
22
23
|
scanBundledManagedAgents: () => Promise<CanonicalEntry[]>;
|
|
23
24
|
getAdapters: () => ProviderAdapter[];
|
|
24
25
|
getActiveAdapters: (adapters: ProviderAdapter[], scopeRoot: string) => Promise<ProviderAdapter[]>;
|
|
25
26
|
getSyncMappings: (adapter: ProviderAdapter, scope: Scope) => PathMapping[];
|
|
27
|
+
getAdoptionSources: (adapter: ProviderAdapter, scope: Scope) => AdoptionSource[];
|
|
26
28
|
detectDrift: (entry: Manifest['entries'][number], scopeRoot: string, copyTransform?: CopyTransform) => Promise<DriftReport>;
|
|
27
|
-
detectStrays: (provider: string, providerDir: string, manifest: Manifest, canonicalEntries: CanonicalEntry[], mapping?: Pick<PathMapping, 'contentType' | 'providerExtension'>) => Promise<DriftReport[]>;
|
|
29
|
+
detectStrays: (provider: string, providerDir: string, manifest: Manifest, canonicalEntries: CanonicalEntry[], mapping?: Pick<PathMapping, 'contentType' | 'nativeRead' | 'providerExtension'>) => Promise<DriftReport[]>;
|
|
28
30
|
detectCodexRoleStrays: (scopeRoot: string, canonicalEntries: CanonicalEntry[], managedRoleNames?: Set<string>) => Promise<CodexRoleStray[]>;
|
|
29
31
|
computeCodexProjectExtensionPlan: (scopeRoot: string, canonicalEntries: CanonicalEntry[], allowedCanonicalPaths?: string[], options?: {
|
|
30
32
|
userConfigDir?: string;
|
|
@@ -37,10 +39,14 @@ interface StatusDependencies {
|
|
|
37
39
|
}) => Promise<CursorExtensionPlan>;
|
|
38
40
|
applyCursorProjectExtensionPlan: (scopeRoot: string, plan: CursorExtensionPlan) => Promise<unknown>;
|
|
39
41
|
selectManyWithAbort: <T extends string>(message: string, choices: MultiSelectChoice<T>[], ctx: PromptContext) => Promise<T[] | null>;
|
|
42
|
+
selectWithAbort: <T extends string>(message: string, choices: SelectChoice<T>[], ctx: PromptContext) => Promise<T | null>;
|
|
40
43
|
confirmAction: (message: string, ctx: PromptContext) => Promise<boolean>;
|
|
41
44
|
adoptStray: (scopeRoot: string, stray: StatusStrayCandidate, manifest: Manifest, options?: {
|
|
42
45
|
replaceCanonical?: boolean;
|
|
43
46
|
}) => Promise<Manifest>;
|
|
47
|
+
applyCursorSkillDisposition: (scopeRoot: string, stray: StatusStrayCandidate, manifest: Manifest, disposition: CursorSkillDisposition, syncConfigPath: string, options?: {
|
|
48
|
+
replaceCanonical?: boolean;
|
|
49
|
+
}) => Promise<Manifest>;
|
|
44
50
|
formatStatusTable: (reports: DriftReport[]) => string;
|
|
45
51
|
}
|
|
46
52
|
interface StatusStrayCandidate {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/status/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,KAAK,cAAc,EAIpB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/status/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,KAAK,cAAc,EA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