8282
8383** Key Components :**
8484
85- - ** Workflows :** Orchestration layer for multi - step operations
8685- ** Generators :** Project and file generation logic
8786- ** Validators :** Commit message validation and system dependency validation
8887- ** GitHub Integration :** API interactions and automation
9695core/
9796├── src/
9897│ ├── index.ts # Core exports
99- │ ├── workflows/ # Workflow orchestration (NEW)
100- │ │ ├── index.ts # Workflows module entry
101- │ │ ├── init.ts # Project initialization
102- │ │ ├── generate.ts # File generation
103- │ │ ├── validate.ts # Validation operations
104- │ │ ├── git.ts # Git workflows
105- │ │ └── release.ts # Release management
106- │ ├── workflows.ts # Legacy re-export (deprecated)
10798│ ├── generators.ts # Project/file generators
10899│ ├── validator.ts # Validation logic
109100│ ├── github.ts # GitHub API integration
@@ -178,116 +169,21 @@ vscode-extension/
178169
179170## 🔄 Data Flow and Interactions
180171
181- ### Workflow Architecture
182-
183- StackCode implements a ** workflow - based architecture ** that provides a clear separation between UI concerns and business logic . This architecture enables both the CLI and VS Code extension to share the same core functionality while providing their own UI experiences .
184-
185- #### Workflow Layers
186-
187- ` ` `
188- ┌─────────────────────────────────────────────────────────────┐
189- │ UI Layer │
190- │ ┌──────────────────┐ ┌──────────────────┐ │
191- │ │ CLI Commands │ │ VS Code Commands│ │
192- │ │ - Inquirer │ │ - Webview UI │ │
193- │ │ - Spinners │ │ - TreeView │ │
194- │ │ - Console │ │ - Notifications │ │
195- │ └────────┬─────────┘ └────────┬─────────┘ │
196- └───────────┼──────────────────────────────┼─────────────────┘
197- │ │
198- └──────────────┬───────────────┘
199- ▼
200- ┌─────────────────────────────────────────────────────────────┐
201- │ Workflow Orchestration │
202- │ ┌──────────────────────────────────────────────────────┐ │
203- │ │ Core Workflows (@stackcode/core/workflows) │ │
204- │ │ ┌────────────┐ ┌────────────┐ ┌────────────┐ │ │
205- │ │ │ Init │ │ Generate │ │ Validate │ │ │
206- │ │ └────────────┘ └────────────┘ └────────────┘ │ │
207- │ │ ┌────────────┐ ┌────────────┐ │ │
208- │ │ │ Git │ │ Release │ │ │
209- │ │ └────────────┘ └────────────┘ │ │
210- │ └──────────────────────────────────────────────────────┘ │
211- └─────────────────────────────────────────────────────────────┘
212- │
213- ▼
214- ┌─────────────────────────────────────────────────────────────┐
215- │ Business Logic │
216- │ ┌──────────────────────────────────────────────────────┐ │
217- │ │ Generators • Validators • Scaffold • Release │ │
218- │ │ GitHub API • Templates • Utils │ │
219- │ └──────────────────────────────────────────────────────┘ │
220- └─────────────────────────────────────────────────────────────┘
221- ` ` `
222-
223- #### Workflow Pattern
224-
225- Each workflow follows a consistent pattern :
226-
227- 1. ** Options Interface :** Defines required inputs
228- 2. ** Hooks Interface :** Provides callbacks for UI integration
229- 3. ** Progress Reporting :** Step - by - step updates via ` onProgress ` hook
230- 4. ** Educational Messages :** Contextual learning via ` onEducationalMessage ` hook
231- 5. ** User Confirmations :** Interactive decisions via confirmation hooks
232- 6. ** Result Object :** Standardized output with status and data
233-
234- ** Example : Init Workflow **
235-
236- ` ` ` typescript
237- // 1. Define Options
238- interface InitWorkflowOptions {
239- projectPath: string;
240- projectName: string;
241- stack: SupportedStack;
242- features: InitFeature[];
243- }
244-
245- // 2. Define Hooks for UI Integration
246- interface InitWorkflowHooks {
247- onProgress?(progress: InitWorkflowProgress): Promise<void> | void;
248- onEducationalMessage?(messageKey: string): Promise<void> | void;
249- onMissingDependencies?(details: InitWorkflowDependencyDecision): Promise<void> | void;
250- confirmContinueAfterMissingDependencies?(decision: InitWorkflowDependencyDecision): Promise<boolean> | boolean;
251- }
252-
253- // 3. Execute Workflow
254- const result = await runInitWorkflow(options, {
255- onProgress: (progress) => {
256- // CLI: Show spinner with progress.step
257- // VS Code: Update TreeView or notification
258- },
259- onEducationalMessage: (key) => {
260- // CLI: Log to console if educate mode is on
261- // VS Code: Show info message
262- }
263- });
264- ` ` `
265-
266- #### Workflow Benefits
267-
268- - ** UI Independence :** Core logic doesn ' t depend on any UI framework
269- - ** Testability :** Workflows can be tested without UI
270- - ** Consistency :** Same behavior across CLI and VS Code extension
271- - ** Progress Tracking :** Fine - grained progress updates for better UX
272- - ** Extensibility :** Easy to add new workflows or extend existing ones
273-
274172### Command Execution Flow
275173
2761741. **User Input :** CLI command or VS Code action
2771752. **Command Parsing :** Yargs (CLI ) or VS Code API
278- 3. ** Workflow Orchestration :** Core workflows coordinate operations
279- 4. ** Business Logic :** Low - level operations in ` @stackcode/core `
280- 5. ** i18n Processing :** Localized messages via ` @stackcode/i18n `
281- 6. ** Output :** Results displayed to user via UI hooks
176+ 3. **Core Logic :** Business logic execution in `@stackcode /core `
177+ 4. **i18n Processing :** Localized messages via `@stackcode /i18n `
178+ 5. **Output :** Results displayed to user
282179
283180### Cross -Package Dependencies
284181
285182```mermaid
286183graph TD
287- A[CLI Package] --> E[Core Workflows]
288- B[VS Code Extension] --> E
289- E[Core Workflows] --> C[Core Package]
184+ A [CLI Package ] --> C [Core Package ]
290185 A --> D [i18n Package ]
186+ B [VS Code Extension ] --> C
291187 B --> D
292188 C --> D
293189```
@@ -413,8 +309,6 @@ StackCode/
413309├── packages/ # All packages
414310│ ├── cli/ # CLI package
415311│ ├── core/ # Core business logic
416- │ │ └── src/
417- │ │ └── workflows/ # Workflow orchestration (domain-based)
418312│ ├── i18n/ # Internationalization
419313│ └── vscode-extension/ # VS Code extension
420314├── docs/ # Project documentation
@@ -428,31 +322,12 @@ Each package follows consistent patterns:
428322
429323- ` src/ ` - Source code
430324- ` test/ ` - Test files
431- - ` dist/ ` - Compiled output (ignored in git )
432- - ` out/ ` - Build artifacts (ignored in git )
325+ - ` dist/ ` - Compiled output
433326- ` package.json ` - Package configuration
434327- ` tsconfig.json ` - TypeScript configuration
435328- ` README.md ` - Package documentation
436329- ` CHANGELOG.md ` - Version history
437330
438- ### Domain - Based Code Organization
439-
440- The core package organizes workflows by domain to improve maintainability :
441-
442- - ** ` workflows/init.ts ` ** - Project initialization workflow
443- - ** ` workflows/generate.ts ` ** - File generation workflow
444- - ** ` workflows/validate.ts ` ** - Validation workflows
445- - ** ` workflows/git.ts ` ** - Git operation workflows
446- - ** ` workflows/release.ts ` ** - Release management workflow
447- - ** ` workflows/index.ts ` ** - Unified exports
448-
449- This organization :
450- - ✅ Improves code navigation and discoverability
451- - ✅ Reduces file size for easier maintenance
452- - ✅ Groups related functionality logically
453- - ✅ Makes it easier to test individual domains
454- - ✅ Facilitates parallel development
455-
456331## 🔧 Build System
457332
458333### TypeScript Compilation
0 commit comments