@ai-outfitter/outfitter 0.11.0 → 1.0.2
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/.outfitter/skills/outfitter/SKILL.md +67 -37
- package/README.md +63 -35
- package/code/enterprise/cli/privateCatalogSettings.cjs +2 -2
- package/code/enterprise/pi-extension/privateCatalogOnboarding.js +5 -8
- package/code/enterprise/shared/privateCatalogPolicy.cjs +5 -5
- package/code/pi-extension/src/outfitter-extension.js +353 -553
- package/code/pi-extension/src/outfitter-runtime-extension.js +160 -0
- package/dist/agents/AgentLaunch.d.ts +9 -1
- package/dist/agents/AgentLaunch.js +19 -0
- package/dist/agents/AgentLaunch.js.map +1 -1
- package/dist/agents/PiCredentialPersistence.d.ts +6 -0
- package/dist/agents/PiCredentialPersistence.js +33 -0
- package/dist/agents/PiCredentialPersistence.js.map +1 -0
- package/dist/cli/OutfitterCli.js +10 -18
- package/dist/cli/OutfitterCli.js.map +1 -1
- package/dist/cli/commands/CommandObject.d.ts +0 -5
- package/dist/cli/commands/CommandObject.js +1 -4
- package/dist/cli/commands/CommandObject.js.map +1 -1
- package/dist/cli/commands/DumpCommand.d.ts +19 -0
- package/dist/cli/commands/DumpCommand.js +54 -0
- package/dist/cli/commands/DumpCommand.js.map +1 -0
- package/dist/cli/commands/ListCommand.d.ts +17 -0
- package/dist/cli/commands/ListCommand.js +77 -0
- package/dist/cli/commands/ListCommand.js.map +1 -0
- package/dist/cli/commands/PiRuntimeLaunch.d.ts +8 -0
- package/dist/cli/commands/PiRuntimeLaunch.js +47 -0
- package/dist/cli/commands/PiRuntimeLaunch.js.map +1 -0
- package/dist/cli/commands/ProcessDefaults.d.ts +2 -0
- package/dist/cli/commands/ProcessDefaults.js +5 -0
- package/dist/cli/commands/ProcessDefaults.js.map +1 -0
- package/dist/cli/commands/RunAgentCommand.d.ts +46 -0
- package/dist/cli/commands/RunAgentCommand.js +176 -0
- package/dist/cli/commands/RunAgentCommand.js.map +1 -0
- package/dist/cli/commands/SetupCommand.d.ts +38 -6
- package/dist/cli/commands/SetupCommand.js +194 -232
- package/dist/cli/commands/SetupCommand.js.map +1 -1
- package/dist/cli/commands/ValidateCommand.d.ts +20 -0
- package/dist/cli/commands/ValidateCommand.js +54 -0
- package/dist/cli/commands/ValidateCommand.js.map +1 -0
- package/dist/composer/Composer.d.ts +11 -0
- package/dist/composer/Composer.js +72 -0
- package/dist/composer/Composer.js.map +1 -0
- package/dist/composer/Composition.d.ts +33 -0
- package/dist/composer/Composition.js +2 -0
- package/dist/composer/Composition.js.map +1 -0
- package/dist/dump/Containment.d.ts +8 -0
- package/dist/dump/Containment.js +22 -0
- package/dist/dump/Containment.js.map +1 -0
- package/dist/dump/Dump.d.ts +8 -0
- package/dist/dump/Dump.js +182 -0
- package/dist/dump/Dump.js.map +1 -0
- package/dist/extensions/PiExtensionCache.d.ts +30 -0
- package/dist/extensions/PiExtensionCache.js +92 -0
- package/dist/extensions/PiExtensionCache.js.map +1 -0
- package/dist/fs/TypeConflict.d.ts +6 -0
- package/dist/fs/TypeConflict.js +21 -0
- package/dist/fs/TypeConflict.js.map +1 -0
- package/dist/paths/OutfitterCache.d.ts +6 -0
- package/dist/paths/OutfitterCache.js +17 -0
- package/dist/paths/OutfitterCache.js.map +1 -0
- package/dist/projection/Materialize.d.ts +24 -0
- package/dist/projection/Materialize.js +83 -0
- package/dist/projection/Materialize.js.map +1 -0
- package/dist/projection/ProjectHarness.d.ts +5 -0
- package/dist/projection/ProjectHarness.js +77 -0
- package/dist/projection/ProjectHarness.js.map +1 -0
- package/dist/projection/Projection.d.ts +23 -0
- package/dist/projection/Projection.js +2 -0
- package/dist/projection/Projection.js.map +1 -0
- package/dist/resolver/AgentDefinition.d.ts +30 -0
- package/dist/resolver/AgentDefinition.js +123 -0
- package/dist/resolver/AgentDefinition.js.map +1 -0
- package/dist/resolver/Layer.d.ts +12 -0
- package/dist/resolver/Layer.js +30 -0
- package/dist/resolver/Layer.js.map +1 -0
- package/dist/resolver/Resolver.d.ts +3 -0
- package/dist/resolver/Resolver.js +163 -0
- package/dist/resolver/Resolver.js.map +1 -0
- package/dist/resolver/ResolverContext.d.ts +15 -0
- package/dist/resolver/ResolverContext.js +11 -0
- package/dist/resolver/ResolverContext.js.map +1 -0
- package/dist/resolver/ResolverValidation.d.ts +11 -0
- package/dist/resolver/ResolverValidation.js +112 -0
- package/dist/resolver/ResolverValidation.js.map +1 -0
- package/dist/resolver/Resource.d.ts +88 -0
- package/dist/resolver/Resource.js +34 -0
- package/dist/resolver/Resource.js.map +1 -0
- package/dist/schemas/agent.schema.json +48 -0
- package/dist/schemas/settings.schema.json +32 -9
- package/dist/settings/Settings.d.ts +34 -5
- package/dist/settings/Settings.js +3 -1
- package/dist/settings/Settings.js.map +1 -1
- package/dist/settings/SettingsLoader.d.ts +1 -1
- package/dist/settings/SettingsLoader.js +23 -22
- package/dist/settings/SettingsLoader.js.map +1 -1
- package/dist/settings/SettingsMerger.js +12 -10
- package/dist/settings/SettingsMerger.js.map +1 -1
- package/dist/setup/DefaultCatalog.d.ts +20 -0
- package/dist/setup/DefaultCatalog.js +89 -0
- package/dist/setup/DefaultCatalog.js.map +1 -0
- package/dist/setup/Setup.d.ts +43 -0
- package/dist/setup/Setup.js +261 -0
- package/dist/setup/Setup.js.map +1 -0
- package/dist/skills/SkillDocument.d.ts +6 -1
- package/dist/skills/SkillDocument.js.map +1 -1
- package/dist/sources/SourceCache.d.ts +19 -0
- package/dist/{profiles/ProfileCache.js → sources/SourceCache.js} +22 -18
- package/dist/sources/SourceCache.js.map +1 -0
- package/dist/validation/SchemaValidator.d.ts +1 -1
- package/dist/validation/SchemaValidator.js +4 -13
- package/dist/validation/SchemaValidator.js.map +1 -1
- package/docs/architecture/state_writeback_strategy.md +54 -122
- package/docs/documentation/README.md +33 -12
- package/docs/documentation/actions.md +35 -52
- package/docs/documentation/agents.md +109 -0
- package/docs/documentation/best-practices.md +25 -63
- package/docs/documentation/catalogs.md +126 -0
- package/docs/documentation/cli.md +39 -41
- package/docs/documentation/concepts.md +66 -23
- package/docs/documentation/dump-and-bake.md +30 -0
- package/docs/documentation/first-time-cli-agent-users.md +8 -8
- package/docs/documentation/getting-started.md +28 -8
- package/docs/documentation/hooks.md +20 -0
- package/docs/documentation/iterating-on-profiles.md +56 -70
- package/docs/documentation/local-development.md +84 -0
- package/docs/documentation/migration.md +39 -0
- package/docs/documentation/personas.md +41 -0
- package/docs/documentation/porting-claude.md +54 -0
- package/docs/documentation/profiles.md +16 -169
- package/docs/documentation/settings.md +61 -0
- package/docs/documentation/skills.md +93 -334
- package/docs/documentation/state.md +24 -62
- package/docs/documentation/subagents.md +37 -0
- package/docs/documentation/support-matrix.md +40 -35
- package/docs/documentation/switching-to-outfitter.md +75 -81
- package/docs/documentation/tasks.md +13 -0
- package/docs/documentation/usecases/engineering.md +67 -84
- package/docs/documentation/usecases/organization-profile-catalog.md +83 -111
- package/docs/documentation/usecases/persona-reviews.md +133 -139
- package/docs/philosophy.md +2 -2
- package/package.json +3 -3
- package/src/schemas/agent.schema.json +48 -0
- package/src/schemas/settings.schema.json +32 -9
- package/dist/agents/AdapterProfileControls.d.ts +0 -21
- package/dist/agents/AdapterProfileControls.js +0 -76
- package/dist/agents/AdapterProfileControls.js.map +0 -1
- package/dist/agents/AdapterStatePaths.d.ts +0 -12
- package/dist/agents/AdapterStatePaths.js +0 -46
- package/dist/agents/AdapterStatePaths.js.map +0 -1
- package/dist/agents/AgentAdapter.d.ts +0 -44
- package/dist/agents/AgentAdapter.js +0 -2
- package/dist/agents/AgentAdapter.js.map +0 -1
- package/dist/agents/AgentRegistry.d.ts +0 -6
- package/dist/agents/AgentRegistry.js +0 -17
- package/dist/agents/AgentRegistry.js.map +0 -1
- package/dist/agents/LaunchResources.d.ts +0 -17
- package/dist/agents/LaunchResources.js +0 -61
- package/dist/agents/LaunchResources.js.map +0 -1
- package/dist/agents/OutfitterSkill.d.ts +0 -11
- package/dist/agents/OutfitterSkill.js +0 -128
- package/dist/agents/OutfitterSkill.js.map +0 -1
- package/dist/agents/ResourceIdentity.d.ts +0 -2
- package/dist/agents/ResourceIdentity.js +0 -51
- package/dist/agents/ResourceIdentity.js.map +0 -1
- package/dist/agents/claude/ClaudeAdapter.d.ts +0 -2
- package/dist/agents/claude/ClaudeAdapter.js +0 -148
- package/dist/agents/claude/ClaudeAdapter.js.map +0 -1
- package/dist/agents/claude/ClaudeCompositeProfileWriter.d.ts +0 -5
- package/dist/agents/claude/ClaudeCompositeProfileWriter.js +0 -7
- package/dist/agents/claude/ClaudeCompositeProfileWriter.js.map +0 -1
- package/dist/agents/pi/PiAdapter.d.ts +0 -2
- package/dist/agents/pi/PiAdapter.js +0 -363
- package/dist/agents/pi/PiAdapter.js.map +0 -1
- package/dist/agents/pi/PiArgs.d.ts +0 -2
- package/dist/agents/pi/PiArgs.js +0 -15
- package/dist/agents/pi/PiArgs.js.map +0 -1
- package/dist/agents/pi/PiCompositeProfileWriter.d.ts +0 -5
- package/dist/agents/pi/PiCompositeProfileWriter.js +0 -7
- package/dist/agents/pi/PiCompositeProfileWriter.js.map +0 -1
- package/dist/agents/pi/PiExtensionCache.d.ts +0 -12
- package/dist/agents/pi/PiExtensionCache.js +0 -195
- package/dist/agents/pi/PiExtensionCache.js.map +0 -1
- package/dist/agents/pi/PiMcpConfig.d.ts +0 -2
- package/dist/agents/pi/PiMcpConfig.js +0 -114
- package/dist/agents/pi/PiMcpConfig.js.map +0 -1
- package/dist/agents/pi/PiSettingsMergePolicy.d.ts +0 -17
- package/dist/agents/pi/PiSettingsMergePolicy.js +0 -59
- package/dist/agents/pi/PiSettingsMergePolicy.js.map +0 -1
- package/dist/agents/pi/PiSkillSources.d.ts +0 -8
- package/dist/agents/pi/PiSkillSources.js +0 -73
- package/dist/agents/pi/PiSkillSources.js.map +0 -1
- package/dist/cli/commands/FirstRunWelcomeProfile.d.ts +0 -11
- package/dist/cli/commands/FirstRunWelcomeProfile.js +0 -110
- package/dist/cli/commands/FirstRunWelcomeProfile.js.map +0 -1
- package/dist/cli/commands/PiLoginLaunch.d.ts +0 -22
- package/dist/cli/commands/PiLoginLaunch.js +0 -170
- package/dist/cli/commands/PiLoginLaunch.js.map +0 -1
- package/dist/cli/commands/RunCommand.d.ts +0 -36
- package/dist/cli/commands/RunCommand.js +0 -345
- package/dist/cli/commands/RunCommand.js.map +0 -1
- package/dist/cli/commands/SyncCommand.d.ts +0 -46
- package/dist/cli/commands/SyncCommand.js +0 -244
- package/dist/cli/commands/SyncCommand.js.map +0 -1
- package/dist/cli/commands/WelcomeCommand.d.ts +0 -56
- package/dist/cli/commands/WelcomeCommand.js +0 -224
- package/dist/cli/commands/WelcomeCommand.js.map +0 -1
- package/dist/cli/commands/assets/outfitter-ascii.txt +0 -5
- package/dist/cli/commands/profile/Command.d.ts +0 -7
- package/dist/cli/commands/profile/Command.js +0 -24
- package/dist/cli/commands/profile/Command.js.map +0 -1
- package/dist/cli/commands/profile/CreateCommand.d.ts +0 -19
- package/dist/cli/commands/profile/CreateCommand.js +0 -115
- package/dist/cli/commands/profile/CreateCommand.js.map +0 -1
- package/dist/cli/commands/profile/LintCommand.d.ts +0 -19
- package/dist/cli/commands/profile/LintCommand.js +0 -155
- package/dist/cli/commands/profile/LintCommand.js.map +0 -1
- package/dist/cli/commands/profile/ListCommand.d.ts +0 -19
- package/dist/cli/commands/profile/ListCommand.js +0 -91
- package/dist/cli/commands/profile/ListCommand.js.map +0 -1
- package/dist/cli/commands/profile/Shared.d.ts +0 -9
- package/dist/cli/commands/profile/Shared.js +0 -10
- package/dist/cli/commands/profile/Shared.js.map +0 -1
- package/dist/cli/commands/run/RunFirstRunOnboarding.d.ts +0 -7
- package/dist/cli/commands/run/RunFirstRunOnboarding.js +0 -52
- package/dist/cli/commands/run/RunFirstRunOnboarding.js.map +0 -1
- package/dist/cli/commands/run/RunLaunchSummary.d.ts +0 -2
- package/dist/cli/commands/run/RunLaunchSummary.js +0 -35
- package/dist/cli/commands/run/RunLaunchSummary.js.map +0 -1
- package/dist/cli/commands/run/RunProfileResolution.d.ts +0 -39
- package/dist/cli/commands/run/RunProfileResolution.js +0 -128
- package/dist/cli/commands/run/RunProfileResolution.js.map +0 -1
- package/dist/cli/commands/run/RunStateWritePrompt.d.ts +0 -2
- package/dist/cli/commands/run/RunStateWritePrompt.js +0 -29
- package/dist/cli/commands/run/RunStateWritePrompt.js.map +0 -1
- package/dist/cli/commands/setup/SetupPrompts.d.ts +0 -14
- package/dist/cli/commands/setup/SetupPrompts.js +0 -296
- package/dist/cli/commands/setup/SetupPrompts.js.map +0 -1
- package/dist/cli/commands/setup/SetupSourceImport.d.ts +0 -5
- package/dist/cli/commands/setup/SetupSourceImport.js +0 -177
- package/dist/cli/commands/setup/SetupSourceImport.js.map +0 -1
- package/dist/cli/commands/setup/SetupSourceLaunch.d.ts +0 -4
- package/dist/cli/commands/setup/SetupSourceLaunch.js +0 -65
- package/dist/cli/commands/setup/SetupSourceLaunch.js.map +0 -1
- package/dist/cli/commands/setup/SetupStarterSource.d.ts +0 -21
- package/dist/cli/commands/setup/SetupStarterSource.js +0 -133
- package/dist/cli/commands/setup/SetupStarterSource.js.map +0 -1
- package/dist/cli/commands/setup/SetupTypes.d.ts +0 -91
- package/dist/cli/commands/setup/SetupTypes.js +0 -26
- package/dist/cli/commands/setup/SetupTypes.js.map +0 -1
- package/dist/compositeProfile/CompositeProfile.d.ts +0 -8
- package/dist/compositeProfile/CompositeProfile.js +0 -6
- package/dist/compositeProfile/CompositeProfile.js.map +0 -1
- package/dist/compositeProfile/CompositeProfileAssembler.d.ts +0 -12
- package/dist/compositeProfile/CompositeProfileAssembler.js +0 -32
- package/dist/compositeProfile/CompositeProfileAssembler.js.map +0 -1
- package/dist/compositeProfile/CompositeProfileCleanup.d.ts +0 -9
- package/dist/compositeProfile/CompositeProfileCleanup.js +0 -87
- package/dist/compositeProfile/CompositeProfileCleanup.js.map +0 -1
- package/dist/compositeProfile/CompositeProfileFile.d.ts +0 -16
- package/dist/compositeProfile/CompositeProfileFile.js +0 -16
- package/dist/compositeProfile/CompositeProfileFile.js.map +0 -1
- package/dist/compositeProfile/CompositeProfileTemplate.d.ts +0 -15
- package/dist/compositeProfile/CompositeProfileTemplate.js +0 -65
- package/dist/compositeProfile/CompositeProfileTemplate.js.map +0 -1
- package/dist/compositeProfile/CompositeProfileWatcher.d.ts +0 -18
- package/dist/compositeProfile/CompositeProfileWatcher.js +0 -46
- package/dist/compositeProfile/CompositeProfileWatcher.js.map +0 -1
- package/dist/compositeProfile/StatePersistence.d.ts +0 -39
- package/dist/compositeProfile/StatePersistence.js +0 -249
- package/dist/compositeProfile/StatePersistence.js.map +0 -1
- package/dist/fs/SafeSymlink.d.ts +0 -13
- package/dist/fs/SafeSymlink.js +0 -50
- package/dist/fs/SafeSymlink.js.map +0 -1
- package/dist/profiles/Profile.d.ts +0 -60
- package/dist/profiles/Profile.js +0 -7
- package/dist/profiles/Profile.js.map +0 -1
- package/dist/profiles/ProfileCache.d.ts +0 -8
- package/dist/profiles/ProfileCache.js.map +0 -1
- package/dist/profiles/ProfileLoader.d.ts +0 -28
- package/dist/profiles/ProfileLoader.js +0 -299
- package/dist/profiles/ProfileLoader.js.map +0 -1
- package/dist/profiles/ProfileMerger.d.ts +0 -19
- package/dist/profiles/ProfileMerger.js +0 -112
- package/dist/profiles/ProfileMerger.js.map +0 -1
- package/dist/profiles/ProfileSource.d.ts +0 -35
- package/dist/profiles/ProfileSource.js +0 -13
- package/dist/profiles/ProfileSource.js.map +0 -1
- package/dist/profiles/PromptIncludes.d.ts +0 -32
- package/dist/profiles/PromptIncludes.js +0 -147
- package/dist/profiles/PromptIncludes.js.map +0 -1
- package/dist/prompts/SystemPromptExport.d.ts +0 -16
- package/dist/prompts/SystemPromptExport.js +0 -81
- package/dist/prompts/SystemPromptExport.js.map +0 -1
- package/dist/schemas/profile-source.schema.json +0 -29
- package/dist/schemas/profile.schema.json +0 -200
- package/dist/skills/ProfileSkillResolution.d.ts +0 -21
- package/dist/skills/ProfileSkillResolution.js +0 -88
- package/dist/skills/ProfileSkillResolution.js.map +0 -1
- package/dist/skills/SkillCatalog.d.ts +0 -41
- package/dist/skills/SkillCatalog.js +0 -119
- package/dist/skills/SkillCatalog.js.map +0 -1
- package/dist/skills/SkillResolution.d.ts +0 -34
- package/dist/skills/SkillResolution.js +0 -369
- package/dist/skills/SkillResolution.js.map +0 -1
- package/docs/documentation/profile-repository.md +0 -179
- package/src/schemas/SchemaDocument.ts +0 -20
- package/src/schemas/profile-source.schema.json +0 -29
- package/src/schemas/profile.schema.json +0 -200
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
// Applies setup-source imports into a home or project .outfitter folder via copy or symlink.
|
|
2
|
-
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { dirname, join } from 'node:path';
|
|
4
|
-
import { parse, stringify } from 'yaml';
|
|
5
|
-
import { createSettingsLoadPlan, loadSettingsFiles } from '../../../settings/SettingsLoader.js';
|
|
6
|
-
import { updateSettingsDefaultProfile } from '../FirstRunWelcomeProfile.js';
|
|
7
|
-
import { readStarterSettingsContent, resolveLocalSetupSourceOutfitterPath, validateStarterSettingsIfPresent, } from './SetupStarterSource.js';
|
|
8
|
-
/* v8 ignore start -- setup-source filesystem import variants are covered by integration-style fixtures; core settings outcomes are unit covered. */
|
|
9
|
-
export const applySetupSourceImport = (input, starterLayout, onboarding) => {
|
|
10
|
-
const target = createSetupSourceImportTargetLayout(input, onboarding.importTarget);
|
|
11
|
-
if (onboarding.importMode === 'symlink') {
|
|
12
|
-
return applySetupSourceSymlinkImport(input, target, onboarding);
|
|
13
|
-
}
|
|
14
|
-
return applySetupSourceCopyImport(starterLayout, target, onboarding);
|
|
15
|
-
};
|
|
16
|
-
const applySetupSourceSymlinkImport = (input, target, onboarding) => {
|
|
17
|
-
const sourceOutfitterPath = resolveLocalSetupSourceOutfitterPath(input);
|
|
18
|
-
if (sourceOutfitterPath === undefined) {
|
|
19
|
-
throw new Error('Local setup-source symlink mode requires a source .outfitter directory.');
|
|
20
|
-
}
|
|
21
|
-
const sourceSettingsPath = join(sourceOutfitterPath, 'settings.yml');
|
|
22
|
-
if (!existsSync(sourceSettingsPath)) {
|
|
23
|
-
throw new Error('Local setup-source symlink mode requires source .outfitter/settings.yml.');
|
|
24
|
-
}
|
|
25
|
-
validateStarterSettingsIfPresent(sourceSettingsPath);
|
|
26
|
-
const sourceProfilesPath = join(sourceOutfitterPath, 'profiles');
|
|
27
|
-
const sourceSelectedProfilePath = findSetupProfilePath(sourceProfilesPath, onboarding.selectedProfileId);
|
|
28
|
-
if (!existsSync(sourceSelectedProfilePath)) {
|
|
29
|
-
throw new Error(`Local setup-source symlink mode requires selected profile '${onboarding.selectedProfileId}'.`);
|
|
30
|
-
}
|
|
31
|
-
symlinkLocalOutfitterSource(sourceOutfitterPath, dirname(target.settingsPath));
|
|
32
|
-
return {
|
|
33
|
-
...target,
|
|
34
|
-
createdSettings: false,
|
|
35
|
-
copiedStarterProfileFiles: 0,
|
|
36
|
-
copiedStarterResourceFiles: 0,
|
|
37
|
-
selectedProfileAlreadyExists: false,
|
|
38
|
-
symlinkedOutfitter: true,
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
const applySetupSourceCopyImport = (starterLayout, target, onboarding) => {
|
|
42
|
-
const createdSettings = createImportSettingsIfMissing(target.settingsPath, starterLayout.settingsPath, onboarding.selectedProfileId);
|
|
43
|
-
const selectedProfilePath = findSetupProfilePath(target.profilesPath, onboarding.selectedProfileId);
|
|
44
|
-
const selectedProfileAlreadyExists = existsSync(selectedProfilePath);
|
|
45
|
-
ensureLocalProfileSource(target.settingsPath, target.profilesPath);
|
|
46
|
-
updateSettingsDefaultProfile(target.settingsPath, onboarding.selectedProfileId);
|
|
47
|
-
return {
|
|
48
|
-
...target,
|
|
49
|
-
createdSettings,
|
|
50
|
-
copiedStarterProfileFiles: copyStarterProfileFilesIfPresent(starterLayout.profilesPath, target.profilesPath),
|
|
51
|
-
copiedStarterResourceFiles: copyStarterResourceFilesIfPresent(starterLayout.profilesPath, dirname(target.settingsPath)),
|
|
52
|
-
selectedProfileAlreadyExists,
|
|
53
|
-
selectedProfileConflictMessage: selectedProfileAlreadyExists
|
|
54
|
-
? `Existing selected setup-source profile '${onboarding.selectedProfileId}' at ${selectedProfilePath} was not overwritten.`
|
|
55
|
-
: undefined,
|
|
56
|
-
symlinkedOutfitter: false,
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
/* v8 ignore stop */
|
|
60
|
-
/* v8 ignore start -- local setup-source symlink safety is covered by filesystem integration tests. */
|
|
61
|
-
const symlinkLocalOutfitterSource = (sourceOutfitterPath, targetOutfitterPath) => {
|
|
62
|
-
if (existsSync(targetOutfitterPath)) {
|
|
63
|
-
const entries = readdirSync(targetOutfitterPath);
|
|
64
|
-
if (entries.length > 0) {
|
|
65
|
-
throw new Error(`Cannot symlink local setup source into non-empty .outfitter directory '${targetOutfitterPath}'. ` +
|
|
66
|
-
'Move it aside or use copy snapshot setup.');
|
|
67
|
-
}
|
|
68
|
-
rmSync(targetOutfitterPath, { recursive: true, force: true });
|
|
69
|
-
}
|
|
70
|
-
mkdirSync(dirname(targetOutfitterPath), { recursive: true });
|
|
71
|
-
symlinkSync(sourceOutfitterPath, targetOutfitterPath, 'dir');
|
|
72
|
-
};
|
|
73
|
-
/* v8 ignore stop */
|
|
74
|
-
const createSetupSourceImportTargetLayout = (input, target) => {
|
|
75
|
-
if (target === 'project') {
|
|
76
|
-
return {
|
|
77
|
-
settingsPath: join(input.projectDirectory, '.outfitter', 'settings.yml'),
|
|
78
|
-
settingsDescription: 'project',
|
|
79
|
-
profilesPath: join(input.projectDirectory, '.outfitter', 'profiles'),
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
settingsPath: join(input.homeDirectory, '.outfitter', 'settings.yml'),
|
|
84
|
-
settingsDescription: 'user',
|
|
85
|
-
profilesPath: join(input.homeDirectory, '.outfitter', 'profiles'),
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
const createImportSettingsIfMissing = (settingsPath, starterSettingsPath, selectedProfileId) => {
|
|
89
|
-
if (existsSync(settingsPath)) {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
mkdirSync(dirname(settingsPath), { recursive: true });
|
|
93
|
-
writeFileSync(settingsPath,
|
|
94
|
-
/* v8 ignore next -- setup-source tests exercise starter settings; missing starter settings is defensive fallback. */
|
|
95
|
-
starterSettingsPath === undefined
|
|
96
|
-
? createLocalProfileSettingsContent(selectedProfileId)
|
|
97
|
-
: readStarterSettingsContent(starterSettingsPath));
|
|
98
|
-
return true;
|
|
99
|
-
};
|
|
100
|
-
const createLocalProfileSettingsContent = (defaultProfileId) => ['default_profile: ' + defaultProfileId, 'profile_sources:', ' - path: ./profiles', ''].join('\n');
|
|
101
|
-
const ensureLocalProfileSource = (settingsPath, profilesPath) => {
|
|
102
|
-
const loaded = loadSettingsFiles(createSettingsLoadPlan([{ scope: 'user', path: settingsPath }]));
|
|
103
|
-
const sources = loaded.files[0]?.settings.profileSources ?? [];
|
|
104
|
-
if (sources.some((source) => source.path === profilesPath)) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const document = readYamlRecord(settingsPath);
|
|
108
|
-
/* v8 ignore next -- appending to existing non-local source lists is equivalent to the covered empty-source case. */
|
|
109
|
-
const existingSources = Array.isArray(document.profile_sources) ? document.profile_sources : [];
|
|
110
|
-
writeFileSync(settingsPath, stringify({ ...document, profile_sources: [...existingSources, { path: './profiles' }] }));
|
|
111
|
-
};
|
|
112
|
-
const readYamlRecord = (path) => {
|
|
113
|
-
const parsed = parse(readFileSync(path, 'utf8'));
|
|
114
|
-
/* v8 ignore next -- settings schema validation guarantees object documents before this helper mutates them. */
|
|
115
|
-
return parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)
|
|
116
|
-
? { ...parsed }
|
|
117
|
-
: {};
|
|
118
|
-
};
|
|
119
|
-
export const copyStarterProfileFilesIfPresent = (sourceProfilesPath, targetProfilesPath) => {
|
|
120
|
-
if (sourceProfilesPath === undefined) {
|
|
121
|
-
return 0;
|
|
122
|
-
}
|
|
123
|
-
return copyDirectoryContentsWithoutOverwriting(sourceProfilesPath, targetProfilesPath);
|
|
124
|
-
};
|
|
125
|
-
const copyStarterResourceFilesIfPresent = (sourceProfilesPath, targetOutfitterPath) => {
|
|
126
|
-
if (sourceProfilesPath === undefined) {
|
|
127
|
-
return 0;
|
|
128
|
-
}
|
|
129
|
-
const sourceOutfitterPath = dirname(sourceProfilesPath);
|
|
130
|
-
return ['prompts', 'deepwork', 'skills'].reduce((copiedFiles, resourceName) => copiedFiles + copyNamedStarterResourceDirectoryIfPresent(sourceOutfitterPath, targetOutfitterPath, resourceName), 0);
|
|
131
|
-
};
|
|
132
|
-
const copyNamedStarterResourceDirectoryIfPresent = (sourceOutfitterPath, targetOutfitterPath, resourceName) => {
|
|
133
|
-
const sourceResourcePath = join(sourceOutfitterPath, resourceName);
|
|
134
|
-
if (!existsSync(sourceResourcePath)) {
|
|
135
|
-
return 0;
|
|
136
|
-
}
|
|
137
|
-
return copyDirectoryContentsWithoutOverwriting(sourceResourcePath, join(targetOutfitterPath, resourceName));
|
|
138
|
-
};
|
|
139
|
-
const copyDirectoryContentsWithoutOverwriting = (sourceDirectory, targetDirectory) => {
|
|
140
|
-
mkdirSync(targetDirectory, { recursive: true });
|
|
141
|
-
let copiedFiles = 0;
|
|
142
|
-
for (const entry of readdirSync(sourceDirectory, { withFileTypes: true })) {
|
|
143
|
-
const sourcePath = join(sourceDirectory, entry.name);
|
|
144
|
-
const targetPath = join(targetDirectory, entry.name);
|
|
145
|
-
if (entry.isDirectory()) {
|
|
146
|
-
copiedFiles += copyDirectoryContentsWithoutOverwriting(sourcePath, targetPath);
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
if (entry.isFile() && !existsSync(targetPath)) {
|
|
150
|
-
mkdirSync(dirname(targetPath), { recursive: true });
|
|
151
|
-
cpSync(sourcePath, targetPath, { force: false });
|
|
152
|
-
copiedFiles += 1;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return copiedFiles;
|
|
156
|
-
};
|
|
157
|
-
export const findSetupProfilePath = (profilesPath, profileId) => {
|
|
158
|
-
for (const profilePath of [
|
|
159
|
-
join(profilesPath, `${profileId}.yml`),
|
|
160
|
-
join(profilesPath, `${profileId}.yaml`),
|
|
161
|
-
join(profilesPath, profileId, 'profile.yml'),
|
|
162
|
-
]) {
|
|
163
|
-
if (existsSync(profilePath)) {
|
|
164
|
-
return profilePath;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
return join(profilesPath, profileId, 'profile.yml');
|
|
168
|
-
};
|
|
169
|
-
export const createDefaultProfileIfMissing = (profilePath, profileId) => {
|
|
170
|
-
if (existsSync(profilePath)) {
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
mkdirSync(dirname(profilePath), { recursive: true });
|
|
174
|
-
writeFileSync(profilePath, `id: ${profileId}\nlabel: Default\ncontrols: {}\n`);
|
|
175
|
-
return true;
|
|
176
|
-
};
|
|
177
|
-
//# sourceMappingURL=SetupSourceImport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SetupSourceImport.js","sourceRoot":"","sources":["../../../../src/cli/commands/setup/SetupSourceImport.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACvH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAExC,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,qCAAq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AE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YACjD,WAAW,IAAI,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,YAAoB,EAAE,SAAiB,EAAU,EAAE;IACtF,KAAK,MAAM,WAAW,IAAI;QACxB,IAAI,CAAC,YAAY,EAAE,GAAG,SAAS,MAAM,CAAC;QACtC,IAAI,CAAC,YAAY,EAAE,GAAG,SAAS,OAAO,CAAC;QACvC,IAAI,CAAC,YAAY,EAAE,SAAS,EAAE,aAAa,CAAC;KAC7C,EAAE,CAAC;QACF,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YAC5B,OAAO,WAAW,CAAC;QACrB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC,YAAY,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,WAAmB,EAAE,SAAiB,EAAW,EAAE;IAC/F,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,aAAa,CAAC,WAAW,EAAE,OAAO,SAAS,kCAAkC,CAAC,CAAC;IAC/E,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { SetupCommandDependencies, SetupCommandInput, SetupSourceImportTarget, SetupSourcePostImportAction, SetupSourcePostImportLaunchTarget } from './SetupTypes.js';
|
|
2
|
-
export declare const formatRunProfileExample: (profileId: string) => string;
|
|
3
|
-
export declare const formatSetupSourceExitMessages: (input: SetupCommandInput, importTarget: SetupSourceImportTarget, profileId: string, launchTarget: SetupSourcePostImportLaunchTarget) => readonly string[];
|
|
4
|
-
export declare const runSetupSourcePostImportAction: (input: SetupCommandInput, dependencies: SetupCommandDependencies, importTarget: SetupSourceImportTarget, profileId: string, launchTarget: SetupSourcePostImportLaunchTarget) => Promise<SetupSourcePostImportAction>;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// Post-import launch messaging and actions for setup-source onboarding.
|
|
2
|
-
import { loadLocalProfileSource } from '../../../profiles/ProfileLoader.js';
|
|
3
|
-
import { resolveProfile } from '../../../profiles/ProfileMerger.js';
|
|
4
|
-
import { loadSettingsWithCachedRemoteSettings } from '../../../settings/SettingsLoader.js';
|
|
5
|
-
import { materializeSetupProfileSource, promptForSetupSourceLaunchAction } from './SetupPrompts.js';
|
|
6
|
-
export const formatRunProfileExample = (profileId) => `Start the selected default profile either way:\n outfitter\n outfitter --profile ${profileId}`;
|
|
7
|
-
const formatRunDefaultProfileExample = () => `Start the current default profile:\n outfitter`;
|
|
8
|
-
/* v8 ignore start -- setup-source launch visibility fallbacks are exercised through integration-style CLI flows; unit tests cover the primary imported-profile outcomes. */
|
|
9
|
-
export const formatSetupSourceExitMessages = (input, importTarget, profileId, launchTarget) => {
|
|
10
|
-
if (launchTarget === 'default') {
|
|
11
|
-
return [formatRunDefaultProfileExample()];
|
|
12
|
-
}
|
|
13
|
-
if (importTarget !== 'home' || canResolveProfileForLaunch(input, profileId)) {
|
|
14
|
-
return [formatRunProfileExample(profileId)];
|
|
15
|
-
}
|
|
16
|
-
return [formatHiddenHomeImportMessage(profileId)];
|
|
17
|
-
};
|
|
18
|
-
const formatHiddenHomeImportMessage = (profileId) => `Imported profile '${profileId}' into user home, but this project overrides profile_sources and does not expose ~/.outfitter/profiles. ` +
|
|
19
|
-
'Import into the current project, add ~/.outfitter/profiles to project profile_sources, or run from a directory without project Outfitter settings.';
|
|
20
|
-
export const runSetupSourcePostImportAction = async (input, dependencies, importTarget, profileId, launchTarget) => {
|
|
21
|
-
if (dependencies.interactive !== true ||
|
|
22
|
-
(dependencies.launchSetupSourceProfile === undefined && dependencies.selectSetupSourceLaunchAction === undefined)) {
|
|
23
|
-
return 'exit';
|
|
24
|
-
}
|
|
25
|
-
const action = await selectSetupSourceLaunchAction(profileId, launchTarget, dependencies);
|
|
26
|
-
if (action === 'start') {
|
|
27
|
-
if (launchTarget === 'selected') {
|
|
28
|
-
assertSetupSourceProfileCanLaunch(input, importTarget, profileId);
|
|
29
|
-
}
|
|
30
|
-
await dependencies.launchSetupSourceProfile?.({
|
|
31
|
-
homeDirectory: input.homeDirectory,
|
|
32
|
-
projectDirectory: input.projectDirectory,
|
|
33
|
-
profileId: launchTarget === 'selected' ? profileId : undefined,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
return action;
|
|
37
|
-
};
|
|
38
|
-
const assertSetupSourceProfileCanLaunch = (input, importTarget, profileId) => {
|
|
39
|
-
if (importTarget !== 'home' || canResolveProfileForLaunch(input, profileId)) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
throw new Error(formatHiddenHomeImportMessage(profileId));
|
|
43
|
-
};
|
|
44
|
-
const canResolveProfileForLaunch = (input, profileId) => {
|
|
45
|
-
const loadedSettings = loadSettingsWithCachedRemoteSettings(input);
|
|
46
|
-
if (loadedSettings.issues.length > 0) {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
const profiles = loadedSettings.settings.profileSources.flatMap((source) => loadLocalProfileSource({
|
|
50
|
-
path: materializeSetupProfileSource(input.homeDirectory, source),
|
|
51
|
-
only: source.only,
|
|
52
|
-
except: source.except,
|
|
53
|
-
}).profiles);
|
|
54
|
-
const resolution = resolveProfile({ profiles, profileId });
|
|
55
|
-
const selectedProfile = resolution.profileStack.find((profile) => profile.id === profileId);
|
|
56
|
-
return resolution.profile !== undefined && resolution.issues.length === 0 && selectedProfile?.template !== true;
|
|
57
|
-
};
|
|
58
|
-
const selectSetupSourceLaunchAction = async (profileId, launchTarget, dependencies) => {
|
|
59
|
-
if (dependencies.selectSetupSourceLaunchAction !== undefined) {
|
|
60
|
-
return dependencies.selectSetupSourceLaunchAction(profileId, launchTarget);
|
|
61
|
-
}
|
|
62
|
-
return promptForSetupSourceLaunchAction(profileId, launchTarget, dependencies);
|
|
63
|
-
};
|
|
64
|
-
/* v8 ignore stop */
|
|
65
|
-
//# sourceMappingURL=SetupSourceLaunch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SetupSourceLaunch.js","sourceRoot":"","sources":["../../../../src/cli/commands/setup/SetupSourceLaunch.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,oCAAoC,EAAE,MAAM,qCAAqC,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AASpG,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,SAAiB,EAAU,EAAE,CACnE,sFAAsF,SAAS,EAAE,CAAC;AAEpG,MAAM,8BAA8B,GAAG,GAAW,EAAE,CAAC,iDAAiD,CAAC;AAEvG,4KAA4K;AAC5K,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,KAAwB,EACxB,YAAqC,EACrC,SAAiB,EACjB,YAA+C,EAC5B,EAAE;IACrB,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,CAAC,8BAA8B,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,YAAY,KAAK,MAAM,IAAI,0BAA0B,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;QAC5E,OAAO,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,CAAC,6BAA6B,CAAC,SAAS,CAAC,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,6BAA6B,GA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} from './SetupTypes.js';
|
|
2
|
-
export declare const prepareStarterLayout: (homeDirectory: string, projectDirectory: string, setupSourceUri: string, synchronizer?: SetupSourceSynchronizer) => StarterLayout;
|
|
3
|
-
export declare const validateStarterSettingsIfPresent: (settingsPath?: string) => void;
|
|
4
|
-
export declare const readStarterDefaultProfileId: (settingsPath?: string) => string;
|
|
5
|
-
export declare const readStarterExplicitDefaultProfileId: (settingsPath?: string) => string | undefined;
|
|
6
|
-
export type LoadedSetupSettingsFile = {
|
|
7
|
-
readonly location: {
|
|
8
|
-
readonly scope: string;
|
|
9
|
-
};
|
|
10
|
-
readonly settings: {
|
|
11
|
-
readonly defaultProfile?: string;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export declare const readUserDefaultProfileId: (files: readonly LoadedSetupSettingsFile[]) => string;
|
|
15
|
-
export declare const ensureExistingUserSettingsDefaultProfile: (settingsPath: string, files: readonly LoadedSetupSettingsFile[], defaultProfileId: string) => void;
|
|
16
|
-
export declare const assertValidDefaultProfileId: (profileId: string) => void;
|
|
17
|
-
export declare const createDefaultSettingsContent: (defaultProfileId?: string) => string;
|
|
18
|
-
export declare const createInitialSettingsIfMissing: (settingsPath: string, starterSettingsPath?: string) => boolean;
|
|
19
|
-
export declare const readStarterSettingsContent: (starterSettingsPath: string) => string;
|
|
20
|
-
export declare const resolveLocalSetupSourceOutfitterPath: (input: SetupCommandInput) => string | undefined;
|
|
21
|
-
export declare const resolveLocalSetupSourceOutfitterPathFromUri: (setupSourceUri: string, projectDirectory: string) => string | undefined;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
// Resolves and validates setup starter sources: local .outfitter folders, remote git caches, and starter settings.
|
|
2
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { dirname, isAbsolute, join, resolve } from 'node:path';
|
|
4
|
-
import spawn from 'cross-spawn';
|
|
5
|
-
import { createRemoteRepositoryCachePath, normalizeGitUri, redactProfileSourceUriCredentials, } from '../../../profiles/ProfileCache.js';
|
|
6
|
-
import { isValidProfileId } from '../../../profiles/ProfileLoader.js';
|
|
7
|
-
import { createSettingsLoadPlan, loadSettingsFiles } from '../../../settings/SettingsLoader.js';
|
|
8
|
-
import { formatSettingsIssue, } from './SetupTypes.js';
|
|
9
|
-
export const prepareStarterLayout = (homeDirectory, projectDirectory, setupSourceUri, synchronizer = createGitSetupSourceSynchronizer()) => {
|
|
10
|
-
const localOutfitterPath = resolveLocalSetupSourceOutfitterPathFromUri(setupSourceUri, projectDirectory);
|
|
11
|
-
if (localOutfitterPath !== undefined) {
|
|
12
|
-
const settingsPath = join(localOutfitterPath, 'settings.yml');
|
|
13
|
-
validateStarterSettingsIfPresent(existsSync(settingsPath) ? settingsPath : undefined);
|
|
14
|
-
return {
|
|
15
|
-
cachePath: localOutfitterPath,
|
|
16
|
-
settingsPath: existsSync(settingsPath) ? settingsPath : undefined,
|
|
17
|
-
profilesPath: firstExistingPath(join(localOutfitterPath, 'profiles')),
|
|
18
|
-
sourceKind: 'local-live',
|
|
19
|
-
sourceOutfitterPath: localOutfitterPath,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
const cachePath = createSetupSourceCachePath(homeDirectory, setupSourceUri);
|
|
23
|
-
synchronizer.sync(setupSourceUri, cachePath);
|
|
24
|
-
const settingsPath = firstExistingPath(join(cachePath, 'settings.yml'), join(cachePath, '.outfitter', 'settings.yml'));
|
|
25
|
-
validateStarterSettingsIfPresent(settingsPath);
|
|
26
|
-
const preferredProfilesPath = settingsPath?.endsWith(join('.outfitter', 'settings.yml'))
|
|
27
|
-
? join(cachePath, '.outfitter', 'profiles')
|
|
28
|
-
: join(cachePath, 'profiles');
|
|
29
|
-
const profilesPath = firstExistingPath(preferredProfilesPath, join(cachePath, 'profiles'), join(cachePath, '.outfitter', 'profiles'));
|
|
30
|
-
return { cachePath, settingsPath, profilesPath, sourceKind: 'remote-cache' };
|
|
31
|
-
};
|
|
32
|
-
const createSetupSourceCachePath = (homeDirectory, setupSourceUri) => createRemoteRepositoryCachePath(homeDirectory, { uri: setupSourceUri });
|
|
33
|
-
const createGitSetupSourceSynchronizer = () => ({
|
|
34
|
-
sync(uri, cachePath) {
|
|
35
|
-
mkdirSync(dirname(cachePath), { recursive: true });
|
|
36
|
-
if (existsSync(cachePath)) {
|
|
37
|
-
runGit(['-C', cachePath, 'pull', '--ff-only'], uri);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
runGit(['clone', '--', normalizeGitUri(uri), cachePath], uri);
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
const runGit = (args, sensitiveUri) => {
|
|
44
|
-
const result = spawn.sync('git', args, { stdio: 'pipe', encoding: 'utf8' });
|
|
45
|
-
if (result.status !== 0) {
|
|
46
|
-
/* v8 ignore next -- the final fallback only applies if git emits no stdout or stderr. */
|
|
47
|
-
throw new Error(redactSensitiveText((result.stderr || result.stdout || `git ${args.join(' ')} failed`).trim(), sensitiveUri));
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
const redactSensitiveText = (message, uri) => message
|
|
51
|
-
.split(uri)
|
|
52
|
-
.join(redactProfileSourceUriCredentials(uri))
|
|
53
|
-
.split(normalizeGitUri(uri))
|
|
54
|
-
.join(redactProfileSourceUriCredentials(normalizeGitUri(uri)));
|
|
55
|
-
const firstExistingPath = (...paths) => paths.find((path) => existsSync(path));
|
|
56
|
-
export const validateStarterSettingsIfPresent = (settingsPath) => {
|
|
57
|
-
if (settingsPath === undefined) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const loaded = loadSettingsFiles(createSettingsLoadPlan([{ scope: 'user', path: settingsPath }]));
|
|
61
|
-
if (loaded.issues.length > 0) {
|
|
62
|
-
throw new Error(`Cannot setup from invalid starter settings: ${loaded.issues.map(formatSettingsIssue).join('; ')}`);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
export const readStarterDefaultProfileId = (settingsPath) => {
|
|
66
|
-
if (settingsPath === undefined) {
|
|
67
|
-
return 'engineer';
|
|
68
|
-
}
|
|
69
|
-
const loaded = loadSettingsFiles(createSettingsLoadPlan([{ scope: 'user', path: settingsPath }]));
|
|
70
|
-
return loaded.files[0]?.settings.defaultProfile ?? 'engineer';
|
|
71
|
-
};
|
|
72
|
-
export const readStarterExplicitDefaultProfileId = (settingsPath) => {
|
|
73
|
-
if (settingsPath === undefined) {
|
|
74
|
-
return undefined;
|
|
75
|
-
}
|
|
76
|
-
const loaded = loadSettingsFiles(createSettingsLoadPlan([{ scope: 'user', path: settingsPath }]));
|
|
77
|
-
return loaded.files[0]?.settings.defaultProfile;
|
|
78
|
-
};
|
|
79
|
-
export const readUserDefaultProfileId = (files) => files.find((file) => file.location.scope === 'user')?.settings.defaultProfile ?? 'engineer';
|
|
80
|
-
export const ensureExistingUserSettingsDefaultProfile = (settingsPath, files, defaultProfileId) => {
|
|
81
|
-
const userSettings = files.find((file) => file.location.scope === 'user');
|
|
82
|
-
if (userSettings === undefined || userSettings.settings.defaultProfile !== undefined) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
const content = readFileSync(settingsPath, 'utf8');
|
|
86
|
-
writeFileSync(settingsPath, `${content}\ndefault_profile: ${defaultProfileId}\n`);
|
|
87
|
-
};
|
|
88
|
-
export const assertValidDefaultProfileId = (profileId) => {
|
|
89
|
-
if (!isValidProfileId(profileId)) {
|
|
90
|
-
throw new Error(`Default profile '${profileId}' is not a filesystem-safe Outfitter profile id.`);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
export const createDefaultSettingsContent = (defaultProfileId = 'engineer') => [
|
|
94
|
-
`default_profile: ${defaultProfileId}`,
|
|
95
|
-
'profile_sources:',
|
|
96
|
-
' - github: ai-outfitter/default-profiles',
|
|
97
|
-
' path: profiles',
|
|
98
|
-
' - path: ./profiles',
|
|
99
|
-
'',
|
|
100
|
-
].join('\n');
|
|
101
|
-
export const createInitialSettingsIfMissing = (settingsPath, starterSettingsPath) => {
|
|
102
|
-
if (existsSync(settingsPath)) {
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
|
-
mkdirSync(dirname(settingsPath), { recursive: true });
|
|
106
|
-
writeFileSync(settingsPath, starterSettingsPath === undefined
|
|
107
|
-
? createDefaultSettingsContent()
|
|
108
|
-
: readStarterSettingsContent(starterSettingsPath));
|
|
109
|
-
return true;
|
|
110
|
-
};
|
|
111
|
-
export const readStarterSettingsContent = (starterSettingsPath) => {
|
|
112
|
-
const content = readFileSync(starterSettingsPath, 'utf8');
|
|
113
|
-
const loaded = loadSettingsFiles(createSettingsLoadPlan([{ scope: 'user', path: starterSettingsPath }]));
|
|
114
|
-
if (loaded.files[0]?.settings.defaultProfile !== undefined) {
|
|
115
|
-
return content;
|
|
116
|
-
}
|
|
117
|
-
return `default_profile: engineer\n${content}`;
|
|
118
|
-
};
|
|
119
|
-
/* v8 ignore start -- local setup-source path probing is covered by filesystem integration tests. */
|
|
120
|
-
export const resolveLocalSetupSourceOutfitterPath = (input) => input.setupSourceUri === undefined
|
|
121
|
-
? undefined
|
|
122
|
-
: resolveLocalSetupSourceOutfitterPathFromUri(input.setupSourceUri, input.projectDirectory);
|
|
123
|
-
export const resolveLocalSetupSourceOutfitterPathFromUri = (setupSourceUri, projectDirectory) => {
|
|
124
|
-
if (isRemoteSetupSourceUri(setupSourceUri)) {
|
|
125
|
-
return undefined;
|
|
126
|
-
}
|
|
127
|
-
const sourcePath = isAbsolute(setupSourceUri) ? setupSourceUri : resolve(projectDirectory, setupSourceUri);
|
|
128
|
-
const outfitterPath = sourcePath.endsWith('.outfitter') ? sourcePath : join(sourcePath, '.outfitter');
|
|
129
|
-
return existsSync(outfitterPath) ? outfitterPath : undefined;
|
|
130
|
-
};
|
|
131
|
-
const isRemoteSetupSourceUri = (source) => /^[a-z][a-z0-9+.-]*:/iu.test(source) && !isAbsolute(source);
|
|
132
|
-
/* v8 ignore stop */
|
|
133
|
-
//# sourceMappingURL=SetupStarterSource.js.map
|
|
@@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,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;IAC3G,MAAM,aAAa,GAAG,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAEtG,OAAO,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/D,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAAC,MAAc,EAAW,EAAE,CAAC,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACxH,oBAAoB"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import type { SyncCommandDependencies, SyncCommandResult } from '../SyncCommand.js';
|
|
2
|
-
import type { WelcomeCommandDependencies, WelcomeCommandResult } from '../WelcomeCommand.js';
|
|
3
|
-
export interface SetupCommandInput {
|
|
4
|
-
readonly homeDirectory: string;
|
|
5
|
-
readonly projectDirectory: string;
|
|
6
|
-
readonly setupSourceUri?: string;
|
|
7
|
-
}
|
|
8
|
-
export interface SetupCommandResult {
|
|
9
|
-
readonly settingsPath: string;
|
|
10
|
-
readonly defaultProfilePath: string;
|
|
11
|
-
readonly createdSettings: boolean;
|
|
12
|
-
readonly copiedStarterProfileFiles: number;
|
|
13
|
-
readonly createdDefaultProfile: boolean;
|
|
14
|
-
readonly syncResult: SyncCommandResult;
|
|
15
|
-
readonly welcomeResult?: WelcomeCommandResult;
|
|
16
|
-
readonly messages: readonly string[];
|
|
17
|
-
}
|
|
18
|
-
export interface SetupSourceSynchronizer {
|
|
19
|
-
sync(uri: string, cachePath: string): void;
|
|
20
|
-
}
|
|
21
|
-
export interface SetupSourceLaunchInput {
|
|
22
|
-
readonly homeDirectory: string;
|
|
23
|
-
readonly projectDirectory: string;
|
|
24
|
-
readonly profileId?: string;
|
|
25
|
-
}
|
|
26
|
-
export interface SetupPiOnboardingLaunchInput {
|
|
27
|
-
readonly homeDirectory: string;
|
|
28
|
-
readonly projectDirectory: string;
|
|
29
|
-
readonly setupSourceUri?: string;
|
|
30
|
-
}
|
|
31
|
-
export type SetupSourcePostImportAction = 'start' | 'exit';
|
|
32
|
-
export type SetupSourcePostImportLaunchTarget = 'selected' | 'default';
|
|
33
|
-
export type SetupCommandDependencies = SyncCommandDependencies & WelcomeCommandDependencies & {
|
|
34
|
-
readonly setupSourceSynchronizer?: SetupSourceSynchronizer;
|
|
35
|
-
readonly selectDefaultProfile?: (profiles: readonly SetupProfileChoice[], currentDefault: string) => Promise<string>;
|
|
36
|
-
readonly selectSetupSourceImportTarget?: (choices: readonly SetupSourceImportTargetChoice[], defaultTarget: SetupSourceImportTarget) => Promise<SetupSourceImportTarget>;
|
|
37
|
-
readonly selectSetupSourceLaunchAction?: (profileId: string, launchTarget: SetupSourcePostImportLaunchTarget) => Promise<SetupSourcePostImportAction>;
|
|
38
|
-
readonly selectSetupSourceImportMode?: (choices: readonly SetupSourceImportModeChoice[], defaultMode: SetupSourceImportMode) => Promise<SetupSourceImportMode>;
|
|
39
|
-
readonly launchSetupSourceProfile?: (input: SetupSourceLaunchInput) => Promise<void>;
|
|
40
|
-
readonly launchPiOnboarding?: (input: SetupPiOnboardingLaunchInput) => Promise<{
|
|
41
|
-
readonly exitCode: number;
|
|
42
|
-
}>;
|
|
43
|
-
readonly runWelcome?: (input: SetupCommandInput, dependencies: SetupCommandDependencies) => Promise<WelcomeCommandResult | undefined>;
|
|
44
|
-
};
|
|
45
|
-
export interface SetupProfileChoice {
|
|
46
|
-
readonly id: string;
|
|
47
|
-
readonly label?: string;
|
|
48
|
-
readonly description?: string;
|
|
49
|
-
}
|
|
50
|
-
export type SetupSourceImportTarget = 'home' | 'project';
|
|
51
|
-
export type SetupSourceImportMode = 'copy' | 'symlink';
|
|
52
|
-
export interface SetupSourceImportTargetChoice {
|
|
53
|
-
readonly target: SetupSourceImportTarget;
|
|
54
|
-
readonly label: string;
|
|
55
|
-
readonly description: string;
|
|
56
|
-
}
|
|
57
|
-
export interface SetupSourceImportModeChoice {
|
|
58
|
-
readonly mode: SetupSourceImportMode;
|
|
59
|
-
readonly label: string;
|
|
60
|
-
readonly description: string;
|
|
61
|
-
}
|
|
62
|
-
export declare const setupSourceImportModeChoices: readonly SetupSourceImportModeChoice[];
|
|
63
|
-
export declare const setupSourceImportTargetChoices: readonly SetupSourceImportTargetChoice[];
|
|
64
|
-
export interface StarterLayout {
|
|
65
|
-
readonly cachePath: string;
|
|
66
|
-
readonly settingsPath?: string;
|
|
67
|
-
readonly profilesPath?: string;
|
|
68
|
-
readonly sourceKind: 'local-live' | 'remote-cache';
|
|
69
|
-
readonly sourceOutfitterPath?: string;
|
|
70
|
-
}
|
|
71
|
-
export interface SetupSourceOnboardingResult {
|
|
72
|
-
readonly importTarget: SetupSourceImportTarget;
|
|
73
|
-
readonly selectedProfileId: string;
|
|
74
|
-
readonly importMode: SetupSourceImportMode;
|
|
75
|
-
}
|
|
76
|
-
export interface AppliedSetupSourceImport {
|
|
77
|
-
readonly settingsPath: string;
|
|
78
|
-
readonly settingsDescription: string;
|
|
79
|
-
readonly profilesPath: string;
|
|
80
|
-
readonly createdSettings: boolean;
|
|
81
|
-
readonly copiedStarterProfileFiles: number;
|
|
82
|
-
readonly copiedStarterResourceFiles: number;
|
|
83
|
-
readonly selectedProfileAlreadyExists: boolean;
|
|
84
|
-
readonly selectedProfileConflictMessage?: string;
|
|
85
|
-
readonly symlinkedOutfitter: boolean;
|
|
86
|
-
}
|
|
87
|
-
export declare const formatSettingsIssue: (issue: {
|
|
88
|
-
readonly filePath: string;
|
|
89
|
-
readonly path: string;
|
|
90
|
-
readonly message: string;
|
|
91
|
-
}) => string;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const setupSourceImportModeChoices = [
|
|
2
|
-
{
|
|
3
|
-
mode: 'copy',
|
|
4
|
-
label: 'Copy snapshot',
|
|
5
|
-
description: 'copy profiles into the selected .outfitter folder; safest for normal use',
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
mode: 'symlink',
|
|
9
|
-
label: 'Symlink for development',
|
|
10
|
-
description: 'link the selected .outfitter folder to the local source so shared profile edits apply immediately',
|
|
11
|
-
},
|
|
12
|
-
];
|
|
13
|
-
export const setupSourceImportTargetChoices = [
|
|
14
|
-
{
|
|
15
|
-
target: 'home',
|
|
16
|
-
label: 'User home',
|
|
17
|
-
description: 'install profiles into ~/.outfitter for all repositories on this machine',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
target: 'project',
|
|
21
|
-
label: 'Current project',
|
|
22
|
-
description: 'install profiles into this project .outfitter folder only',
|
|
23
|
-
},
|
|
24
|
-
];
|
|
25
|
-
export const formatSettingsIssue = (issue) => `${issue.filePath}#${issue.path} ${issue.message}`;
|
|
26
|
-
//# sourceMappingURL=SetupTypes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SetupTypes.js","sourceRoot":"","sources":["../../../../src/cli/commands/setup/SetupTypes.ts"],"names":[],"mappings":"AAyFA,MAAM,CAAC,MAAM,4BAA4B,GAA2C;IAClF;QACE,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,0EAA0E;KACxF;IACD;QACE,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,yBAAyB;QAChC,WAAW,EAAE,mGAAmG;KACjH;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAA6C;IACtF;QACE,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,yEAAyE;KACvF;IACD;QACE,MAAM,EAAE,SAAS;QACjB,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,2DAA2D;KACzE;CACF,CAAC;AA4BF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAInC,EAAU,EAAE,CAAC,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { CompositeProfileStatePath } from './StatePersistence.js';
|
|
2
|
-
import type { CompositeProfileFile } from './CompositeProfileFile.js';
|
|
3
|
-
export interface CompositeProfile {
|
|
4
|
-
readonly rootDirectory: string;
|
|
5
|
-
readonly files: readonly CompositeProfileFile[];
|
|
6
|
-
readonly statePaths: readonly CompositeProfileStatePath[];
|
|
7
|
-
}
|
|
8
|
-
export declare const createCompositeProfile: (rootDirectory: string, files: readonly CompositeProfileFile[], statePaths?: readonly CompositeProfileStatePath[]) => CompositeProfile;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeProfile.js","sourceRoot":"","sources":["../../src/compositeProfile/CompositeProfile.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,aAAqB,EACrB,KAAsC,EACtC,aAAmD,EAAE,EACnC,EAAE,CAAC,CAAC;IACtB,aAAa;IACb,KAAK;IACL,UAAU;CACX,CAAC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { CompositeProfile } from './CompositeProfile.js';
|
|
2
|
-
import type { CompositeProfileFile } from './CompositeProfileFile.js';
|
|
3
|
-
export interface CompositeProfileAssemblyInput {
|
|
4
|
-
readonly rootDirectory?: string;
|
|
5
|
-
readonly files: readonly CompositeProfileFile[];
|
|
6
|
-
}
|
|
7
|
-
export interface CompositeProfileWriteOptions {
|
|
8
|
-
readonly materializeStatePaths?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare const createCompositeProfileRootDirectory: (profileId: string, agentId: string) => string;
|
|
11
|
-
export declare const assembleCompositeProfile: (input: CompositeProfileAssemblyInput) => CompositeProfile;
|
|
12
|
-
export declare const writeCompositeProfile: (compositeProfile: CompositeProfile, options?: CompositeProfileWriteOptions) => void;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// Provides composite profile assembly and disk writing for generated logical files.
|
|
2
|
-
import { mkdtempSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { tmpdir } from 'node:os';
|
|
4
|
-
import { dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
5
|
-
import { createCompositeProfile } from './CompositeProfile.js';
|
|
6
|
-
import { materializeCompositeProfileStatePath } from './StatePersistence.js';
|
|
7
|
-
export const createCompositeProfileRootDirectory = (profileId, agentId) => mkdtempSync(join(tmpdir(), `outfitter-${profileId}-${agentId}-`));
|
|
8
|
-
export const assembleCompositeProfile = (input) => createCompositeProfile(input.rootDirectory ?? createCompositeProfileRootDirectory('profile', 'agent'), input.files);
|
|
9
|
-
export const writeCompositeProfile = (compositeProfile, options = {}) => {
|
|
10
|
-
mkdirSync(compositeProfile.rootDirectory, { recursive: true });
|
|
11
|
-
for (const file of compositeProfile.files) {
|
|
12
|
-
const outputPath = resolveCompositeProfileFileOutputPath(compositeProfile.rootDirectory, file.outputPath);
|
|
13
|
-
mkdirSync(dirname(outputPath), { recursive: true });
|
|
14
|
-
writeFileSync(outputPath, file.content);
|
|
15
|
-
}
|
|
16
|
-
if (options.materializeStatePaths === false) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
for (const statePath of compositeProfile.statePaths.filter((statePath) => statePath.relativePath !== 'unknown')) {
|
|
20
|
-
materializeCompositeProfileStatePath(compositeProfile.rootDirectory, statePath);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const resolveCompositeProfileFileOutputPath = (rootDirectory, outputPath) => {
|
|
24
|
-
const resolvedRootDirectory = resolve(rootDirectory);
|
|
25
|
-
const resolvedOutputPath = isAbsolute(outputPath) ? resolve(outputPath) : resolve(rootDirectory, outputPath);
|
|
26
|
-
const relativeOutputPath = relative(resolvedRootDirectory, resolvedOutputPath);
|
|
27
|
-
if (relativeOutputPath.startsWith('..') || isAbsolute(relativeOutputPath)) {
|
|
28
|
-
throw new Error(`CompositeProfile file output path '${outputPath}' must stay under compositeProfile root '${rootDirectory}'.`);
|
|
29
|
-
}
|
|
30
|
-
return resolvedOutputPath;
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=CompositeProfileAssembler.js.map
|