44import * as vscode from 'vscode' ;
55import * as fs from 'fs' ;
66import * as path from 'path' ;
7- import type { AgenticFlowConfig , SessionState , StepConfig } from './types' ;
7+ import type { AgenticFlowConfig , RunProfileId , SessionState , StepConfig } from './types' ;
88
99const DEFAULT_STORAGE_DIR = '.agentic-flow' ;
1010const CONFIG_BASENAME = 'config.json' ;
@@ -13,6 +13,24 @@ const SESSION_BASENAME = 'session.json';
1313const RUNTIME_ENV_BASENAME = 'runtime.env' ;
1414const SKILLS_DIRNAME = 'skills' ;
1515
16+ export const RUN_PROFILE_PRESETS : Record < Exclude < RunProfileId , 'custom' > , { label : string ; description : string ; enabledStepIds : string [ ] } > = {
17+ lite : {
18+ label : 'Lite' ,
19+ description : 'Fastest practical flow for small or iterative changes.' ,
20+ enabledStepIds : [ 'spec' , 'implement' , 'review' , 'fix' , 'final-report' ] ,
21+ } ,
22+ standard : {
23+ label : 'Standard' ,
24+ description : 'Balanced flow with architecture and formal pre-check before coding.' ,
25+ enabledStepIds : [ 'spec' , 'architecture' , 'formal-precheck' , 'implement' , 'review' , 'fix' , 'final-report' ] ,
26+ } ,
27+ full : {
28+ label : 'Full' ,
29+ description : 'Extended flow with planning, testing, security, docs and runtime verification.' ,
30+ enabledStepIds : [ 'spec' , 'architecture' , 'implementation-plan' , 'formal-precheck' , 'implement' , 'review' , 'fix' , 'test' , 'security' , 'docs' , 'hard-check' , 'final-report' ] ,
31+ } ,
32+ } ;
33+
1634const DEFAULT_STEPS : StepConfig [ ] = [
1735 {
1836 id : 'spec' ,
@@ -37,7 +55,7 @@ const DEFAULT_STEPS: StepConfig[] = [
3755 {
3856 id : 'implementation-plan' ,
3957 name : '🗺 Development Plan' ,
40- enabled : true ,
58+ enabled : false ,
4159 model : 'claude-sonnet-4-6' ,
4260 skill : '.agentic-flow/skills/implementation-plan.md' ,
4361 contextMode : 'summary' ,
@@ -88,7 +106,7 @@ const DEFAULT_STEPS: StepConfig[] = [
88106 {
89107 id : 'test' ,
90108 name : '🧪 Tests & Verification' ,
91- enabled : true ,
109+ enabled : false ,
92110 model : 'claude-sonnet-4-6' ,
93111 skill : '.agentic-flow/skills/testing.md' ,
94112 contextMode : 'summary' ,
@@ -98,7 +116,7 @@ const DEFAULT_STEPS: StepConfig[] = [
98116 {
99117 id : 'security' ,
100118 name : '🔒 Security Review' ,
101- enabled : true ,
119+ enabled : false ,
102120 model : 'gpt-5.4' ,
103121 skill : '.agentic-flow/skills/security.md' ,
104122 contextMode : 'summary' ,
@@ -108,7 +126,7 @@ const DEFAULT_STEPS: StepConfig[] = [
108126 {
109127 id : 'docs' ,
110128 name : '📚 Documentation' ,
111- enabled : true ,
129+ enabled : false ,
112130 model : 'gpt-5.4-mini' ,
113131 skill : '.agentic-flow/skills/docs.md' ,
114132 contextMode : 'summary' ,
@@ -145,6 +163,7 @@ const DEFAULT_STEPS: StepConfig[] = [
145163
146164export const DEFAULT_CONFIG : AgenticFlowConfig = {
147165 version : '2.0' ,
166+ runProfile : 'standard' ,
148167 steps : DEFAULT_STEPS ,
149168 stateFile : path . join ( DEFAULT_STORAGE_DIR , STATE_BASENAME ) ,
150169 sessionFile : path . join ( DEFAULT_STORAGE_DIR , SESSION_BASENAME ) ,
@@ -195,6 +214,7 @@ export function loadConfig(): AgenticFlowConfig {
195214 return {
196215 ...DEFAULT_CONFIG ,
197216 ...parsed ,
217+ runProfile : normalizeRunProfile ( parsed . runProfile ) ,
198218 steps : mergeSteps ( parsed . steps ) ,
199219 runtime : {
200220 ...DEFAULT_CONFIG . runtime ,
@@ -234,12 +254,25 @@ function mergeSteps(parsedSteps?: StepConfig[]): StepConfig[] {
234254 return merged ;
235255}
236256
257+ export function normalizeRunProfile ( profile ?: string ) : RunProfileId {
258+ return profile === 'lite' || profile === 'standard' || profile === 'full' || profile === 'custom'
259+ ? profile
260+ : 'standard' ;
261+ }
262+
263+ export function applyRunProfileToSteps ( steps : StepConfig [ ] , profile : RunProfileId ) : StepConfig [ ] {
264+ if ( profile === 'custom' ) return structuredClone ( steps ) ;
265+ const preset = RUN_PROFILE_PRESETS [ profile ] ;
266+ const enabled = new Set ( preset . enabledStepIds ) ;
267+ return steps . map ( step => ( { ...step , enabled : enabled . has ( step . id ) } ) ) ;
268+ }
269+
237270export function saveConfig ( config : AgenticFlowConfig ) : void {
238271 const dir = getAgenticFlowDir ( ) ;
239272 if ( ! dir ) throw new Error ( 'No workspace open' ) ;
240273 if ( ! fs . existsSync ( dir ) ) fs . mkdirSync ( dir , { recursive : true } ) ;
241274 const p = path . join ( dir , CONFIG_BASENAME ) ;
242- fs . writeFileSync ( p , JSON . stringify ( config , null , 2 ) , 'utf8' ) ;
275+ fs . writeFileSync ( p , JSON . stringify ( { ... config , runProfile : normalizeRunProfile ( config . runProfile ) } , null , 2 ) , 'utf8' ) ;
243276}
244277
245278export async function initWorkspace ( defaultModel ?: string ) : Promise < void > {
0 commit comments