@ai-outfitter/outfitter 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/LICENSE.md +58 -0
  2. package/README.md +256 -0
  3. package/dist/agents/AdapterProfileControls.d.ts +20 -0
  4. package/dist/agents/AdapterProfileControls.js +63 -0
  5. package/dist/agents/AdapterProfileControls.js.map +1 -0
  6. package/dist/agents/AdapterStatePaths.d.ts +12 -0
  7. package/dist/agents/AdapterStatePaths.js +44 -0
  8. package/dist/agents/AdapterStatePaths.js.map +1 -0
  9. package/dist/agents/AgentAdapter.d.ts +32 -0
  10. package/dist/agents/AgentAdapter.js +2 -0
  11. package/dist/agents/AgentAdapter.js.map +1 -0
  12. package/dist/agents/AgentRegistry.d.ts +6 -0
  13. package/dist/agents/AgentRegistry.js +17 -0
  14. package/dist/agents/AgentRegistry.js.map +1 -0
  15. package/dist/agents/LaunchResources.d.ts +13 -0
  16. package/dist/agents/LaunchResources.js +35 -0
  17. package/dist/agents/LaunchResources.js.map +1 -0
  18. package/dist/agents/ResourceIdentity.d.ts +2 -0
  19. package/dist/agents/ResourceIdentity.js +51 -0
  20. package/dist/agents/ResourceIdentity.js.map +1 -0
  21. package/dist/agents/claude/ClaudeAdapter.d.ts +2 -0
  22. package/dist/agents/claude/ClaudeAdapter.js +117 -0
  23. package/dist/agents/claude/ClaudeAdapter.js.map +1 -0
  24. package/dist/agents/claude/ClaudeCompositeProfileWriter.d.ts +5 -0
  25. package/dist/agents/claude/ClaudeCompositeProfileWriter.js +7 -0
  26. package/dist/agents/claude/ClaudeCompositeProfileWriter.js.map +1 -0
  27. package/dist/agents/pi/PiAdapter.d.ts +2 -0
  28. package/dist/agents/pi/PiAdapter.js +229 -0
  29. package/dist/agents/pi/PiAdapter.js.map +1 -0
  30. package/dist/agents/pi/PiCompositeProfileWriter.d.ts +5 -0
  31. package/dist/agents/pi/PiCompositeProfileWriter.js +7 -0
  32. package/dist/agents/pi/PiCompositeProfileWriter.js.map +1 -0
  33. package/dist/agents/pi/PiMcpConfig.d.ts +2 -0
  34. package/dist/agents/pi/PiMcpConfig.js +114 -0
  35. package/dist/agents/pi/PiMcpConfig.js.map +1 -0
  36. package/dist/agents/pi/PiSettingsMergePolicy.d.ts +17 -0
  37. package/dist/agents/pi/PiSettingsMergePolicy.js +59 -0
  38. package/dist/agents/pi/PiSettingsMergePolicy.js.map +1 -0
  39. package/dist/cli/OutfitterCli.d.ts +4 -0
  40. package/dist/cli/OutfitterCli.js +32 -0
  41. package/dist/cli/OutfitterCli.js.map +1 -0
  42. package/dist/cli/commands/CommandObject.d.ts +11 -0
  43. package/dist/cli/commands/CommandObject.js +5 -0
  44. package/dist/cli/commands/CommandObject.js.map +1 -0
  45. package/dist/cli/commands/FirstRunWelcomeProfile.d.ts +11 -0
  46. package/dist/cli/commands/FirstRunWelcomeProfile.js +107 -0
  47. package/dist/cli/commands/FirstRunWelcomeProfile.js.map +1 -0
  48. package/dist/cli/commands/PiLoginLaunch.d.ts +10 -0
  49. package/dist/cli/commands/PiLoginLaunch.js +76 -0
  50. package/dist/cli/commands/PiLoginLaunch.js.map +1 -0
  51. package/dist/cli/commands/RunCommand.d.ts +30 -0
  52. package/dist/cli/commands/RunCommand.js +299 -0
  53. package/dist/cli/commands/RunCommand.js.map +1 -0
  54. package/dist/cli/commands/SetupCommand.d.ts +34 -0
  55. package/dist/cli/commands/SetupCommand.js +379 -0
  56. package/dist/cli/commands/SetupCommand.js.map +1 -0
  57. package/dist/cli/commands/SyncCommand.d.ts +28 -0
  58. package/dist/cli/commands/SyncCommand.js +178 -0
  59. package/dist/cli/commands/SyncCommand.js.map +1 -0
  60. package/dist/cli/commands/WelcomeCommand.d.ts +54 -0
  61. package/dist/cli/commands/WelcomeCommand.js +214 -0
  62. package/dist/cli/commands/WelcomeCommand.js.map +1 -0
  63. package/dist/cli/commands/profile/Command.d.ts +6 -0
  64. package/dist/cli/commands/profile/Command.js +21 -0
  65. package/dist/cli/commands/profile/Command.js.map +1 -0
  66. package/dist/cli/commands/profile/CreateCommand.d.ts +19 -0
  67. package/dist/cli/commands/profile/CreateCommand.js +115 -0
  68. package/dist/cli/commands/profile/CreateCommand.js.map +1 -0
  69. package/dist/cli/commands/profile/ListCommand.d.ts +17 -0
  70. package/dist/cli/commands/profile/ListCommand.js +85 -0
  71. package/dist/cli/commands/profile/ListCommand.js.map +1 -0
  72. package/dist/cli/commands/profile/Shared.d.ts +9 -0
  73. package/dist/cli/commands/profile/Shared.js +10 -0
  74. package/dist/cli/commands/profile/Shared.js.map +1 -0
  75. package/dist/cli.d.ts +3 -0
  76. package/dist/cli.js +22 -0
  77. package/dist/cli.js.map +1 -0
  78. package/dist/compositeProfile/CompositeProfile.d.ts +8 -0
  79. package/dist/compositeProfile/CompositeProfile.js +6 -0
  80. package/dist/compositeProfile/CompositeProfile.js.map +1 -0
  81. package/dist/compositeProfile/CompositeProfileAssembler.d.ts +12 -0
  82. package/dist/compositeProfile/CompositeProfileAssembler.js +32 -0
  83. package/dist/compositeProfile/CompositeProfileAssembler.js.map +1 -0
  84. package/dist/compositeProfile/CompositeProfileFile.d.ts +16 -0
  85. package/dist/compositeProfile/CompositeProfileFile.js +16 -0
  86. package/dist/compositeProfile/CompositeProfileFile.js.map +1 -0
  87. package/dist/compositeProfile/CompositeProfileTemplate.d.ts +15 -0
  88. package/dist/compositeProfile/CompositeProfileTemplate.js +65 -0
  89. package/dist/compositeProfile/CompositeProfileTemplate.js.map +1 -0
  90. package/dist/compositeProfile/CompositeProfileWatcher.d.ts +18 -0
  91. package/dist/compositeProfile/CompositeProfileWatcher.js +46 -0
  92. package/dist/compositeProfile/CompositeProfileWatcher.js.map +1 -0
  93. package/dist/compositeProfile/StatePersistence.d.ts +24 -0
  94. package/dist/compositeProfile/StatePersistence.js +224 -0
  95. package/dist/compositeProfile/StatePersistence.js.map +1 -0
  96. package/dist/merge/ArrayMergePolicy.d.ts +8 -0
  97. package/dist/merge/ArrayMergePolicy.js +45 -0
  98. package/dist/merge/ArrayMergePolicy.js.map +1 -0
  99. package/dist/merge/SettingsValueMerger.d.ts +11 -0
  100. package/dist/merge/SettingsValueMerger.js +34 -0
  101. package/dist/merge/SettingsValueMerger.js.map +1 -0
  102. package/dist/profiles/Profile.d.ts +32 -0
  103. package/dist/profiles/Profile.js +7 -0
  104. package/dist/profiles/Profile.js.map +1 -0
  105. package/dist/profiles/ProfileCache.d.ts +8 -0
  106. package/dist/profiles/ProfileCache.js +36 -0
  107. package/dist/profiles/ProfileCache.js.map +1 -0
  108. package/dist/profiles/ProfileLoader.d.ts +24 -0
  109. package/dist/profiles/ProfileLoader.js +169 -0
  110. package/dist/profiles/ProfileLoader.js.map +1 -0
  111. package/dist/profiles/ProfileMerger.d.ts +20 -0
  112. package/dist/profiles/ProfileMerger.js +97 -0
  113. package/dist/profiles/ProfileMerger.js.map +1 -0
  114. package/dist/profiles/ProfileSource.d.ts +35 -0
  115. package/dist/profiles/ProfileSource.js +13 -0
  116. package/dist/profiles/ProfileSource.js.map +1 -0
  117. package/dist/schemas/profile-source.schema.json +29 -0
  118. package/dist/schemas/profile.schema.json +115 -0
  119. package/dist/schemas/settings.schema.json +37 -0
  120. package/dist/settings/Settings.d.ts +17 -0
  121. package/dist/settings/Settings.js +5 -0
  122. package/dist/settings/Settings.js.map +1 -0
  123. package/dist/settings/SettingsLoader.d.ts +33 -0
  124. package/dist/settings/SettingsLoader.js +129 -0
  125. package/dist/settings/SettingsLoader.js.map +1 -0
  126. package/dist/settings/SettingsMerger.d.ts +2 -0
  127. package/dist/settings/SettingsMerger.js +31 -0
  128. package/dist/settings/SettingsMerger.js.map +1 -0
  129. package/dist/validation/SchemaValidator.d.ts +11 -0
  130. package/dist/validation/SchemaValidator.js +36 -0
  131. package/dist/validation/SchemaValidator.js.map +1 -0
  132. package/dist/validation/YamlDocument.d.ts +13 -0
  133. package/dist/validation/YamlDocument.js +11 -0
  134. package/dist/validation/YamlDocument.js.map +1 -0
  135. package/doc/.deepreview +30 -0
  136. package/doc/architecture.md +834 -0
  137. package/doc/controllable-elements.md +162 -0
  138. package/doc/file_structure.md +133 -0
  139. package/doc/integration_test_system.md +214 -0
  140. package/doc/specs/validating_requirements_with_rules.md +55 -0
  141. package/doc/state_writeback_strategy.md +334 -0
  142. package/package.json +73 -0
  143. package/requirements/OFTR-001-project-foundation.md +53 -0
  144. package/requirements/OFTR-002-settings.md +65 -0
  145. package/requirements/OFTR-003-profiles.md +51 -0
  146. package/requirements/OFTR-004-sync-and-setup.md +57 -0
  147. package/requirements/OFTR-005-run-and-composite-profile.md +60 -0
  148. package/requirements/OFTR-006-agent-adapters.md +64 -0
  149. package/requirements/OFTR-007-controllable-elements.md +32 -0
  150. package/requirements/OFTR-008-requirements-governance.md +42 -0
  151. package/requirements/OFTR-009-release-publishing.md +25 -0
  152. package/requirements/OFTR-010-onboarding-welcome.md +38 -0
  153. package/src/schemas/SchemaDocument.ts +20 -0
  154. package/src/schemas/profile-source.schema.json +29 -0
  155. package/src/schemas/profile.schema.json +115 -0
  156. package/src/schemas/settings.schema.json +37 -0
@@ -0,0 +1,299 @@
1
+ // Provides the command object for launching selected profiles.
2
+ import { existsSync } from 'node:fs';
3
+ import { homedir } from 'node:os';
4
+ import { join } from 'node:path';
5
+ import chalk from 'chalk';
6
+ import spawn from 'cross-spawn';
7
+ import { createAgentAdapter, defaultAgentId as registryDefaultAgentId } from '../../agents/AgentRegistry.js';
8
+ import { createProfileSourceCachePath, createRemoteRepositoryCachePath, redactProfileSourceUriCredentials, resolveRemoteRepositorySubpath, } from '../../profiles/ProfileCache.js';
9
+ import { loadLocalProfileSource } from '../../profiles/ProfileLoader.js';
10
+ import { resolveProfile } from '../../profiles/ProfileMerger.js';
11
+ import { loadSettingsWithCachedRemoteSettings } from '../../settings/SettingsLoader.js';
12
+ import { createCompositeProfileRootDirectory, writeCompositeProfile, } from '../../compositeProfile/CompositeProfileAssembler.js';
13
+ import { renderCompositeProfileTemplates } from '../../compositeProfile/CompositeProfileTemplate.js';
14
+ import { createCompositeProfileStateBaseline, detectCompositeProfileStateWrites, updateCompositeProfileStateBaselinePaths, } from '../../compositeProfile/StatePersistence.js';
15
+ import { watchCompositeProfileInputs } from '../../compositeProfile/CompositeProfileWatcher.js';
16
+ import { preparePiLoginLaunchPlan } from './PiLoginLaunch.js';
17
+ import { executeSetupCommand } from './SetupCommand.js';
18
+ export const executeRunCommand = async (input, dependencies = {}) => {
19
+ const setupResult = await runSetupIfNeeded(input, dependencies);
20
+ const resolvedProfile = loadResolvedProfile(input);
21
+ const adapter = dependencies.adapter ?? createAgentAdapter(selectRunAgentId(input.agentId, resolvedProfile.settings.defaultAgent));
22
+ const compositeProfileRootDirectory = createCompositeProfileRootDirectory(resolvedProfile.profile.id, adapter.id);
23
+ const compositeProfilePlan = createAdapterCompositeProfilePlan(adapter, resolvedProfile, compositeProfileRootDirectory);
24
+ const warnings = compositeProfilePlan.warnings;
25
+ failStrictOnWarnings(adapter.id, warnings, input.strict);
26
+ emitWarnings(warnings, dependencies.writeError);
27
+ writeCompositeProfile(compositeProfilePlan.compositeProfile);
28
+ let stateBaseline = createCompositeProfileStateBaseline(compositeProfilePlan.compositeProfile.rootDirectory, compositeProfilePlan.compositeProfile.statePaths);
29
+ const launchPlan = preparePiLoginLaunchPlan({
30
+ adapterId: adapter.id,
31
+ homeDirectory: input.homeDirectory,
32
+ launchPlan: adapter.createLaunchPlan(compositeProfilePlan.compositeProfile, resolvedProfile.profile, input.passThroughArgs ?? [], { profileFolders: resolvedProfile.profileFolders }),
33
+ setupResult,
34
+ writeLine: dependencies.writeLine,
35
+ });
36
+ emitLaunchSummary(resolvedProfile, adapter.id, compositeProfilePlan.compositeProfile.rootDirectory, dependencies.writeLine);
37
+ const watcher = watchCompositeProfileInputs({
38
+ compositeProfile: compositeProfilePlan.compositeProfile,
39
+ refreshCompositeProfile: () => createAdapterCompositeProfilePlan(adapter, loadResolvedProfile(input), compositeProfileRootDirectory)
40
+ .compositeProfile,
41
+ onCompositeProfileWritten: (compositeProfile) => {
42
+ stateBaseline = updateCompositeProfileStateBaselinePaths(compositeProfile.rootDirectory, stateBaseline, compositeProfile.files.map((file) => file.outputPath));
43
+ },
44
+ /* v8 ignore next -- watcher warnings are covered in CompositeProfileWatcher tests; this adapter passes the stderr writer through. */
45
+ warn: (message) => (dependencies.writeError ?? console.error)(message),
46
+ });
47
+ try {
48
+ const launcher = dependencies.launcher ??
49
+ /* v8 ignore next -- tests inject launchers instead of spawning pi. */ createSpawnLauncher();
50
+ const exitCode = await launcher.launch(launchPlan);
51
+ const stateWriteWarnings = handleCompositeProfileStateWrites(adapter.id, compositeProfilePlan.compositeProfile.rootDirectory, compositeProfilePlan.compositeProfile.statePaths, stateBaseline);
52
+ failStrictOnWarnings(adapter.id, stateWriteWarnings, input.strict);
53
+ emitWarnings(stateWriteWarnings, dependencies.writeError);
54
+ return {
55
+ profileId: resolvedProfile.profile.id,
56
+ agentId: adapter.id,
57
+ launchPlan,
58
+ compositeProfileDirectory: compositeProfilePlan.compositeProfile.rootDirectory,
59
+ warnings: [...warnings, ...stateWriteWarnings],
60
+ exitCode,
61
+ };
62
+ }
63
+ finally {
64
+ watcher.close();
65
+ }
66
+ };
67
+ /* v8 ignore start -- Commander registration is exercised through CLI integration, while command behavior is unit-tested through executeRunCommand. */
68
+ export const createRunCommand = (dependencies = {}) => {
69
+ const command = {
70
+ name: 'run',
71
+ description: 'Assemble a profile compositeProfile and launch the selected agent CLI.',
72
+ register(program) {
73
+ const action = async (args, options) => {
74
+ const result = await executeRunCommand({
75
+ homeDirectory: dependencies.homeDirectory ?? homedir(),
76
+ projectDirectory: dependencies.projectDirectory ?? process.cwd(),
77
+ profileId: options.profile,
78
+ agentId: options.agent,
79
+ strict: options.strict,
80
+ passThroughArgs: args,
81
+ }, dependencies);
82
+ if (result.exitCode !== 0) {
83
+ process.exitCode = result.exitCode;
84
+ }
85
+ };
86
+ configureRunCommander(program.command(command.name, { isDefault: true }).description(command.description), action);
87
+ },
88
+ };
89
+ return command;
90
+ };
91
+ const configureRunCommander = (command, action) => {
92
+ command
93
+ .argument('[args...]')
94
+ .option('-p, --profile <profile>', 'Outfitter profile id to run')
95
+ .option('--agent <agent>', 'agent adapter to launch: pi or claude')
96
+ .option('--strict', 'Fail instead of warning when controls cannot be translated')
97
+ .allowUnknownOption(true)
98
+ .allowExcessArguments(true)
99
+ .action(action);
100
+ };
101
+ const failStrictOnWarnings = (adapterId, warnings, strict) => {
102
+ if (strict === true && warnings.length > 0) {
103
+ throw new Error(`Strict failed for ${adapterId}: ${warnings.join('; ')}`);
104
+ }
105
+ };
106
+ const emitWarnings = (warnings, writeError) => {
107
+ const writer = writeError ?? console.error;
108
+ for (const warning of warnings) {
109
+ writer(warning);
110
+ }
111
+ };
112
+ const emitLaunchSummary = (resolvedProfile, adapterId, compositeProfileRootDirectory, writeLine) => {
113
+ const writer = writeLine ?? console.log;
114
+ const model = selectSummaryModel(resolvedProfile.profile, adapterId);
115
+ writer(`${chalk.magenta('→')} resolving profile ${chalk.yellow(resolvedProfile.profile.id)}`);
116
+ for (const layer of resolvedProfile.profileLayers) {
117
+ writer(`${chalk.green('✓')} profile layer ${chalk.yellow(layer.profile.id)} ${chalk.dim(formatProfileLayerSource(layer))}`);
118
+ }
119
+ writer(`${chalk.green('✓')} merged controls${model === undefined ? '' : ` model=${chalk.yellow(model)}`}`);
120
+ writer(`${chalk.green('✓')} prepared composite profile ${chalk.dim(compositeProfileRootDirectory)}`);
121
+ writer(`${chalk.blue('↳')} launching ${chalk.cyan(adapterId)} …`);
122
+ };
123
+ const selectSummaryModel = (profile, adapterId) => {
124
+ if (adapterId === 'claude') {
125
+ return profile.controls.claude?.model ?? profile.controls.model;
126
+ }
127
+ return profile.controls.pi?.model ?? profile.controls.model;
128
+ };
129
+ const formatProfileLayerSource = (layer) => {
130
+ if (layer.source.github !== undefined) {
131
+ return formatRemoteProfileSource(`github:${layer.source.github}`, layer.source.ref, layer.source.path);
132
+ }
133
+ if (layer.source.uri !== undefined) {
134
+ return formatRemoteProfileSource(redactProfileSourceUriCredentials(layer.source.uri), layer.source.ref, layer.source.path);
135
+ }
136
+ return layer.folderPath;
137
+ };
138
+ const formatRemoteProfileSource = (source, ref, path) => {
139
+ const refSuffix = ref === undefined ? '' : `@${ref}`;
140
+ const pathSuffix = path === undefined ? '' : `/${path}`;
141
+ return `${source}${refSuffix}${pathSuffix}`;
142
+ };
143
+ const createAdapterCompositeProfilePlan = (adapter, resolvedProfile, rootDirectory) => {
144
+ const compositeProfilePlan = adapter.createCompositeProfile(resolvedProfile.profile, {
145
+ rootDirectory,
146
+ profilePaths: resolvedProfile.profilePaths,
147
+ profileFolders: resolvedProfile.profileFolders,
148
+ homeDirectory: resolvedProfile.homeDirectory,
149
+ cacheDirectory: resolvedProfile.cacheDirectory,
150
+ settings: resolvedProfile.settings,
151
+ projectDirectory: resolvedProfile.projectDirectory,
152
+ });
153
+ return {
154
+ ...compositeProfilePlan,
155
+ compositeProfile: renderCompositeProfileTemplates({
156
+ compositeProfile: compositeProfilePlan.compositeProfile,
157
+ settings: resolvedProfile.settings,
158
+ settingsPaths: resolvedProfile.settingsPaths,
159
+ profile: resolvedProfile.profile,
160
+ agentId: adapter.id,
161
+ projectDirectory: resolvedProfile.projectDirectory,
162
+ }),
163
+ };
164
+ };
165
+ const handleCompositeProfileStateWrites = (adapterId, compositeProfileRootDirectory, statePaths, stateBaseline) => {
166
+ const warnings = [];
167
+ for (const issue of detectCompositeProfileStateWrites(compositeProfileRootDirectory, statePaths, stateBaseline)) {
168
+ if (issue.strategy === 'error') {
169
+ throw new Error(formatCompositeProfileStateWriteIssue(adapterId, issue));
170
+ }
171
+ warnings.push(formatCompositeProfileStateWriteIssue(adapterId, issue));
172
+ }
173
+ return warnings;
174
+ };
175
+ const formatCompositeProfileStateWriteIssue = (adapterId, issue) => {
176
+ if (issue.unknown) {
177
+ return `${adapterId} wrote undeclared composite profile state '${issue.relativePath}' and it was not persisted.`;
178
+ }
179
+ if (issue.strategy === 'symlink') {
180
+ return `${adapterId} replaced symlinked state path '${issue.relativePath}' and the change was not persisted.`;
181
+ }
182
+ return `${adapterId} wrote '${issue.relativePath}' with state_persistence '${issue.strategy}' and it was not persisted.`;
183
+ };
184
+ const runSetupIfNeeded = async (input, dependencies) => {
185
+ const settingsPath = join(input.homeDirectory, '.outfitter', 'settings.yml');
186
+ if (existsSync(settingsPath)) {
187
+ return undefined;
188
+ }
189
+ /* v8 ignore next -- console fallback is direct CLI behavior; tests inject a writer. */
190
+ (dependencies.writeLine ?? console.log)('`outfitter setup` has not been run yet - running now');
191
+ return executeSetupCommand(input, { ...dependencies, interactive: shouldRunFirstSetupInteractively(dependencies) });
192
+ };
193
+ const shouldRunFirstSetupInteractively = (dependencies) => {
194
+ if (dependencies.interactive !== undefined) {
195
+ return dependencies.interactive;
196
+ }
197
+ /* v8 ignore next -- default process streams are direct terminal behavior; tests inject streams. */
198
+ const inputIsTty = (dependencies.input ?? process.stdin).isTTY === true;
199
+ /* v8 ignore next -- default process streams are direct terminal behavior; tests inject streams. */
200
+ const outputIsTty = (dependencies.output ?? process.stdout).isTTY === true;
201
+ return inputIsTty && outputIsTty;
202
+ };
203
+ const loadResolvedProfile = (input) => {
204
+ const loadedSettings = loadSettingsWithCachedRemoteSettings(input);
205
+ if (loadedSettings.issues.length > 0) {
206
+ throw new Error(`Cannot run with invalid settings: ${loadedSettings.issues.map(formatSettingsIssue).join('; ')}`);
207
+ }
208
+ const loadedProfiles = loadProfileSources(input.homeDirectory, loadedSettings.settings.profileSources);
209
+ if (loadedProfiles.issues.length > 0) {
210
+ throw new Error(`Cannot run with invalid profiles: ${loadedProfiles.issues.map(formatProfileIssue).join('; ')}`);
211
+ }
212
+ const profileId = selectRunProfileId(input.profileId, loadedSettings.settings.defaultProfile);
213
+ const resolution = resolveProfile({
214
+ profiles: loadedProfiles.profiles,
215
+ profileId,
216
+ defaultProfileId: loadedSettings.settings.defaultProfile,
217
+ });
218
+ if (resolution.profile === undefined || resolution.issues.length > 0) {
219
+ throw new Error(`Cannot resolve profile '${profileId}': ${resolution.issues.map(formatProfileIssue).join('; ')}`);
220
+ }
221
+ return {
222
+ profile: resolution.profile,
223
+ profileLayers: findContributingLoadedProfiles(resolution.profileStack, loadedProfiles.profiles),
224
+ profilePaths: findContributingProfilePaths(resolution.profileStack, loadedProfiles.profiles),
225
+ profileFolders: findContributingProfileFolders(resolution.profileStack, loadedProfiles.profiles),
226
+ homeDirectory: input.homeDirectory,
227
+ cacheDirectory: loadedSettings.settings.cacheDirectory ?? join(input.homeDirectory, '.outfitter', 'cache'),
228
+ projectDirectory: input.projectDirectory,
229
+ settings: loadedSettings.settings,
230
+ settingsPaths: loadedSettings.files.map((file) => file.location.path),
231
+ };
232
+ };
233
+ const selectRunAgentId = (selectedAgentId, defaultAgentId) => selectedAgentId ?? defaultAgentId ?? registryDefaultAgentId;
234
+ const selectRunProfileId = (selectedProfileId, defaultProfileId) => {
235
+ if (selectedProfileId !== undefined) {
236
+ return selectedProfileId;
237
+ }
238
+ if (defaultProfileId !== undefined) {
239
+ return defaultProfileId;
240
+ }
241
+ throw new Error('Cannot run without a selected profile or default_profile in settings.yml; pass --profile or run `outfitter setup`.');
242
+ };
243
+ const findContributingProfilePaths = (profileStack, loadedProfiles) => findContributingLoadedProfiles(profileStack, loadedProfiles).map((loadedProfile) => loadedProfile.profilePath);
244
+ const findContributingProfileFolders = (profileStack, loadedProfiles) => findContributingLoadedProfiles(profileStack, loadedProfiles).map((loadedProfile) => loadedProfile.folderPath);
245
+ const findContributingLoadedProfiles = (profileStack, loadedProfiles) => profileStack.flatMap((profile) => loadedProfiles.filter((loadedProfile) => loadedProfile.profile.id === profile.id));
246
+ const loadProfileSources = (homeDirectory, sources) => {
247
+ const profiles = [];
248
+ const issues = [];
249
+ for (const source of sources) {
250
+ const materializedSource = materializeSource(homeDirectory, source);
251
+ const result = loadLocalProfileSource(materializedSource);
252
+ profiles.push(...result.profiles.map((profile) => ({ ...profile, source })));
253
+ issues.push(...result.issues);
254
+ }
255
+ return { profiles, issues };
256
+ };
257
+ const materializeSource = (homeDirectory, source) => {
258
+ if (source.uri === undefined && source.github === undefined) {
259
+ return source;
260
+ }
261
+ if (source.uri !== undefined && source.ref === undefined && source.path === undefined) {
262
+ return { path: createProfileSourceCachePath(homeDirectory, source.uri), only: source.only, except: source.except };
263
+ }
264
+ return {
265
+ path: resolveRemoteRepositorySubpath(createRemoteRepositoryCachePath(homeDirectory, source), source.path),
266
+ only: source.only,
267
+ except: source.except,
268
+ };
269
+ };
270
+ /* v8 ignore start -- the real child-process launcher is direct runtime behavior; tests inject a launcher. */
271
+ const createSpawnLauncher = () => ({
272
+ launch(plan) {
273
+ return new Promise((resolve, reject) => {
274
+ const child = spawn(plan.command, plan.args, {
275
+ env: { ...process.env, ...plan.env },
276
+ stdio: 'inherit',
277
+ });
278
+ child.on('error', reject);
279
+ child.on('close', (code, signal) => resolve(resolveChildExitCode(code, signal)));
280
+ });
281
+ },
282
+ });
283
+ /* v8 ignore stop */
284
+ export const resolveChildExitCode = (code, signal) => {
285
+ if (code !== null) {
286
+ return code;
287
+ }
288
+ if (signal !== null) {
289
+ return 128 + (signalNumbers[signal] ?? 1);
290
+ }
291
+ return 1;
292
+ };
293
+ const signalNumbers = {
294
+ SIGINT: 2,
295
+ SIGTERM: 15,
296
+ };
297
+ const formatSettingsIssue = (issue) => `${issue.filePath}#${issue.path} ${issue.message}`;
298
+ const formatProfileIssue = (issue) => `${issue.path} ${issue.message}`;
299
+ //# sourceMappingURL=RunCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunCommand.js","sourceRoot":"","sources":["../../../src/cli/commands/RunCommand.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AA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M,kBAAkB,GAAG,CAAC,KAA0D,EAAU,EAAE,CAChG,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { CommandObject } from './CommandObject.js';
2
+ import { updateSettingsDefaultProfile } from './FirstRunWelcomeProfile.js';
3
+ import type { SyncCommandDependencies, SyncCommandResult } from './SyncCommand.js';
4
+ import type { WelcomeCommandDependencies, WelcomeCommandResult } from './WelcomeCommand.js';
5
+ export interface SetupCommandInput {
6
+ readonly homeDirectory: string;
7
+ readonly projectDirectory: string;
8
+ readonly setupSourceUri?: string;
9
+ }
10
+ export interface SetupCommandResult {
11
+ readonly settingsPath: string;
12
+ readonly defaultProfilePath: string;
13
+ readonly createdSettings: boolean;
14
+ readonly copiedStarterProfileFiles: number;
15
+ readonly createdDefaultProfile: boolean;
16
+ readonly syncResult: SyncCommandResult;
17
+ readonly welcomeResult?: WelcomeCommandResult;
18
+ readonly messages: readonly string[];
19
+ }
20
+ export interface SetupSourceSynchronizer {
21
+ sync(uri: string, cachePath: string): void;
22
+ }
23
+ export type SetupCommandDependencies = SyncCommandDependencies & WelcomeCommandDependencies & {
24
+ readonly setupSourceSynchronizer?: SetupSourceSynchronizer;
25
+ readonly selectDefaultProfile?: (profiles: readonly SetupProfileChoice[], currentDefault: string) => Promise<string>;
26
+ readonly runWelcome?: (input: SetupCommandInput, dependencies: SetupCommandDependencies) => Promise<WelcomeCommandResult | undefined>;
27
+ };
28
+ export interface SetupProfileChoice {
29
+ readonly id: string;
30
+ readonly label?: string;
31
+ }
32
+ export declare const executeSetupCommand: (input: SetupCommandInput, dependencies?: SetupCommandDependencies) => Promise<SetupCommandResult>;
33
+ export declare const createSetupCommand: (dependencies?: SetupCommandDependencies) => CommandObject;
34
+ export { updateSettingsDefaultProfile };