Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,9 @@ openspec config profile

# Fast preset: switch workflows to core (keeps delivery mode)
openspec config profile core

# Fast preset: select all workflows (keeps delivery mode)
openspec config profile all
```

`openspec config profile` starts with a current-state summary, then lets you choose:
Expand Down
15 changes: 10 additions & 5 deletions src/commands/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,19 +459,24 @@ export function registerConfigCommand(program: Command): void {
.command('profile [preset]')
.description('Configure workflow profile (interactive picker or preset shortcut)')
.action(async (preset?: string) => {
// Preset shortcut: `openspec config profile core`
if (preset === 'core') {
// Preset shortcuts: `openspec config profile core` / `openspec config profile all`
if (preset === 'core' || preset === 'all') {
const config = getGlobalConfig();
config.profile = 'core';
config.workflows = [...CORE_WORKFLOWS];
if (preset === 'core') {
config.profile = 'core';
config.workflows = [...CORE_WORKFLOWS];
} else {
config.profile = 'custom';
config.workflows = [...ALL_WORKFLOWS];
}
// Preserve delivery setting
saveGlobalConfig(config);
printConfigProfileApplyGuidance();
return;
}

if (preset) {
console.error(`Error: Unknown profile preset "${preset}". Available presets: core`);
console.error(`Error: Unknown profile preset "${preset}". Available presets: core, all`);
process.exitCode = 1;
return;
}
Expand Down
18 changes: 18 additions & 0 deletions test/commands/config-profile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,24 @@ describe('config profile interactive flow', () => {
expect(confirm).not.toHaveBeenCalled();
});

it('all preset should select every workflow and preserve delivery setting', async () => {
const { saveGlobalConfig, getGlobalConfig } = await import('../../src/core/global-config.js');
const { ALL_WORKFLOWS } = await import('../../src/core/profiles.js');
const { select, checkbox, confirm } = await getPromptMocks();

saveGlobalConfig({ featureFlags: {}, profile: 'core', delivery: 'skills', workflows: ['explore'] });

await runConfigCommand(['profile', 'all']);

const config = getGlobalConfig();
expect(config.profile).toBe('custom');
expect(config.delivery).toBe('skills');
expect(config.workflows).toEqual([...ALL_WORKFLOWS]);
expect(select).not.toHaveBeenCalled();
expect(checkbox).not.toHaveBeenCalled();
expect(confirm).not.toHaveBeenCalled();
});

it('Ctrl+C should cancel without stack trace and set interrupted exit code', async () => {
const { select, checkbox, confirm } = await getPromptMocks();
const cancellationError = new Error('User force closed the prompt with SIGINT');
Expand Down
Loading