@eldrforge/tree-execution 0.1.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.
- package/LICENSE +22 -0
- package/README.md +130 -0
- package/dist/TreeExecutor.d.ts +113 -0
- package/dist/TreeExecutor.d.ts.map +1 -0
- package/dist/TreeExecutor.js +113 -0
- package/dist/TreeExecutor.js.map +1 -0
- package/dist/checkpoint/CheckpointManager.d.ts +18 -0
- package/dist/checkpoint/CheckpointManager.d.ts.map +1 -0
- package/dist/checkpoint/CheckpointManager.js +156 -0
- package/dist/checkpoint/CheckpointManager.js.map +1 -0
- package/dist/checkpoint/index.d.ts +5 -0
- package/dist/checkpoint/index.d.ts.map +1 -0
- package/dist/checkpoint/index.js +5 -0
- package/dist/checkpoint/index.js.map +1 -0
- package/dist/execution/CommandValidator.d.ts +25 -0
- package/dist/execution/CommandValidator.d.ts.map +1 -0
- package/dist/execution/CommandValidator.js +129 -0
- package/dist/execution/CommandValidator.js.map +1 -0
- package/dist/execution/DependencyChecker.d.ts +47 -0
- package/dist/execution/DependencyChecker.d.ts.map +1 -0
- package/dist/execution/DependencyChecker.js +95 -0
- package/dist/execution/DependencyChecker.js.map +1 -0
- package/dist/execution/DynamicTaskPool.d.ts +118 -0
- package/dist/execution/DynamicTaskPool.d.ts.map +1 -0
- package/dist/execution/DynamicTaskPool.js +658 -0
- package/dist/execution/DynamicTaskPool.js.map +1 -0
- package/dist/execution/RecoveryManager.d.ts +89 -0
- package/dist/execution/RecoveryManager.d.ts.map +1 -0
- package/dist/execution/RecoveryManager.js +592 -0
- package/dist/execution/RecoveryManager.js.map +1 -0
- package/dist/execution/ResourceMonitor.d.ts +73 -0
- package/dist/execution/ResourceMonitor.d.ts.map +1 -0
- package/dist/execution/ResourceMonitor.js +148 -0
- package/dist/execution/ResourceMonitor.js.map +1 -0
- package/dist/execution/Scheduler.d.ts +36 -0
- package/dist/execution/Scheduler.d.ts.map +1 -0
- package/dist/execution/Scheduler.js +83 -0
- package/dist/execution/Scheduler.js.map +1 -0
- package/dist/execution/TreeExecutionAdapter.d.ts +45 -0
- package/dist/execution/TreeExecutionAdapter.d.ts.map +1 -0
- package/dist/execution/TreeExecutionAdapter.js +249 -0
- package/dist/execution/TreeExecutionAdapter.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/tree.d.ts +13 -0
- package/dist/tree.d.ts.map +1 -0
- package/dist/tree.js +2453 -0
- package/dist/tree.js.map +1 -0
- package/dist/types/config.d.ts +172 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +2 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/parallelExecution.d.ts +108 -0
- package/dist/types/parallelExecution.d.ts.map +1 -0
- package/dist/types/parallelExecution.js +2 -0
- package/dist/types/parallelExecution.js.map +1 -0
- package/dist/util/commandStubs.d.ts +22 -0
- package/dist/util/commandStubs.d.ts.map +1 -0
- package/dist/util/commandStubs.js +49 -0
- package/dist/util/commandStubs.js.map +1 -0
- package/dist/util/logger.d.ts +14 -0
- package/dist/util/logger.d.ts.map +1 -0
- package/dist/util/logger.js +15 -0
- package/dist/util/logger.js.map +1 -0
- package/dist/util/mutex.d.ts +38 -0
- package/dist/util/mutex.d.ts.map +1 -0
- package/dist/util/mutex.js +101 -0
- package/dist/util/mutex.js.map +1 -0
- package/dist/util/treeUtils.d.ts +46 -0
- package/dist/util/treeUtils.d.ts.map +1 -0
- package/dist/util/treeUtils.js +74 -0
- package/dist/util/treeUtils.js.map +1 -0
- package/package.json +64 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Calen Varek
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# @eldrforge/tree-execution
|
|
2
|
+
|
|
3
|
+
Parallel execution framework and tree orchestration for monorepo workflows.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🚀 **Parallel Execution** - Run tasks concurrently with dependency awareness
|
|
8
|
+
- 🔄 **Smart Scheduling** - Priority-based task scheduling
|
|
9
|
+
- 💾 **Checkpoint/Resume** - Save and restore execution state
|
|
10
|
+
- 🛡️ **Error Recovery** - Sophisticated error handling and rollback
|
|
11
|
+
- 📊 **Progress Tracking** - Real-time execution progress
|
|
12
|
+
- 🎯 **Resource Management** - CPU and memory-aware execution
|
|
13
|
+
- ⚡ **Retry Logic** - Exponential backoff for transient failures
|
|
14
|
+
- 🎭 **Dependency Injection** - Flexible command integration
|
|
15
|
+
- 🧪 **Fully Tested** - 140+ tests with excellent coverage
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @eldrforge/tree-execution
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Quick Start - TreeExecutor (Recommended)
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { createTreeExecutor } from '@eldrforge/tree-execution';
|
|
29
|
+
|
|
30
|
+
// Create executor with custom commands
|
|
31
|
+
const executor = createTreeExecutor({
|
|
32
|
+
commands: {
|
|
33
|
+
commit: myCommitCommand,
|
|
34
|
+
publish: myPublishCommand
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Execute tree command
|
|
39
|
+
const result = await executor.execute(config);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Advanced - DynamicTaskPool
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { DynamicTaskPool } from '@eldrforge/tree-execution';
|
|
46
|
+
import { buildDependencyGraph } from '@eldrforge/tree-core';
|
|
47
|
+
|
|
48
|
+
// Build dependency graph
|
|
49
|
+
const graph = await buildDependencyGraph(packagePaths);
|
|
50
|
+
|
|
51
|
+
// Create execution pool
|
|
52
|
+
const pool = new DynamicTaskPool({
|
|
53
|
+
graph,
|
|
54
|
+
maxConcurrency: 4,
|
|
55
|
+
command: 'npm test',
|
|
56
|
+
config: runConfig
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Execute with parallel coordination
|
|
60
|
+
const result = await pool.execute();
|
|
61
|
+
|
|
62
|
+
console.log(`Completed: ${result.completed.length}`);
|
|
63
|
+
console.log(`Failed: ${result.failed.length}`);
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Custom Logger
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { setLogger } from '@eldrforge/tree-execution';
|
|
70
|
+
|
|
71
|
+
setLogger({
|
|
72
|
+
info: (...args) => myLogger.info(...args),
|
|
73
|
+
error: (...args) => myLogger.error(...args),
|
|
74
|
+
warn: (...args) => myLogger.warn(...args),
|
|
75
|
+
verbose: (...args) => myLogger.verbose(...args),
|
|
76
|
+
debug: (...args) => myLogger.debug(...args),
|
|
77
|
+
silly: (...args) => myLogger.silly(...args)
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Components
|
|
82
|
+
|
|
83
|
+
### TreeExecutor (New!)
|
|
84
|
+
High-level class-based API with dependency injection. Encapsulates all state management and provides clean integration points.
|
|
85
|
+
|
|
86
|
+
### DynamicTaskPool
|
|
87
|
+
Orchestrates parallel execution with dependency awareness.
|
|
88
|
+
|
|
89
|
+
### RecoveryManager
|
|
90
|
+
Handles error recovery, rollback, and state validation.
|
|
91
|
+
|
|
92
|
+
### Scheduler
|
|
93
|
+
Decides which packages to execute next based on dependencies and resources.
|
|
94
|
+
|
|
95
|
+
### ResourceMonitor
|
|
96
|
+
Tracks available execution slots and resource usage.
|
|
97
|
+
|
|
98
|
+
### CheckpointManager
|
|
99
|
+
Saves and restores execution state for resume capability.
|
|
100
|
+
|
|
101
|
+
### CommandValidator
|
|
102
|
+
Validates commands for parallel execution safety.
|
|
103
|
+
|
|
104
|
+
### DependencyChecker
|
|
105
|
+
Verifies package dependencies and readiness.
|
|
106
|
+
|
|
107
|
+
## Testing
|
|
108
|
+
|
|
109
|
+
This package includes 140+ comprehensive tests:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npm test # Run tests
|
|
113
|
+
npm run test:coverage # Run with coverage
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Test Coverage**:
|
|
117
|
+
- TreeExecutor: 94.82%
|
|
118
|
+
- Utilities: 80%+
|
|
119
|
+
- Execution framework: 60%+
|
|
120
|
+
|
|
121
|
+
## Dependencies
|
|
122
|
+
|
|
123
|
+
- `@eldrforge/tree-core` - Dependency graph algorithms
|
|
124
|
+
- `@eldrforge/git-tools` - Git operations
|
|
125
|
+
- `@eldrforge/shared` - Shared utilities
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT © Calen Varek
|
|
130
|
+
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TreeExecutor - Class-based tree command orchestration
|
|
3
|
+
*
|
|
4
|
+
* Refactored from tree.ts to use instance state instead of global state
|
|
5
|
+
* and dependency injection for commands.
|
|
6
|
+
*/
|
|
7
|
+
import type { TreeExecutionConfig } from './types/config.js';
|
|
8
|
+
/**
|
|
9
|
+
* Published version tracking
|
|
10
|
+
*/
|
|
11
|
+
export interface PublishedVersion {
|
|
12
|
+
packageName: string;
|
|
13
|
+
version: string;
|
|
14
|
+
publishTime: Date;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Tree execution context for persistence
|
|
18
|
+
*/
|
|
19
|
+
export interface TreeExecutionContext {
|
|
20
|
+
command: string;
|
|
21
|
+
originalConfig: TreeExecutionConfig;
|
|
22
|
+
publishedVersions: PublishedVersion[];
|
|
23
|
+
completedPackages: string[];
|
|
24
|
+
buildOrder: string[];
|
|
25
|
+
startTime: Date;
|
|
26
|
+
lastUpdateTime: Date;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Command executor interface for dependency injection
|
|
30
|
+
*/
|
|
31
|
+
export interface CommandExecutor {
|
|
32
|
+
execute(config: TreeExecutionConfig, mode?: string): Promise<any>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Command registry for built-in commands
|
|
36
|
+
*/
|
|
37
|
+
export interface CommandRegistry {
|
|
38
|
+
updates?: CommandExecutor;
|
|
39
|
+
commit?: CommandExecutor;
|
|
40
|
+
link?: CommandExecutor;
|
|
41
|
+
unlink?: CommandExecutor;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* TreeExecutor options
|
|
45
|
+
*/
|
|
46
|
+
export interface TreeExecutorOptions {
|
|
47
|
+
/**
|
|
48
|
+
* Command registry for dependency injection
|
|
49
|
+
*/
|
|
50
|
+
commands?: CommandRegistry;
|
|
51
|
+
/**
|
|
52
|
+
* Custom logger (optional)
|
|
53
|
+
*/
|
|
54
|
+
logger?: any;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* TreeExecutor - Orchestrates tree command execution
|
|
58
|
+
*
|
|
59
|
+
* This class encapsulates all state that was previously global,
|
|
60
|
+
* making it testable and allowing multiple concurrent executions.
|
|
61
|
+
*/
|
|
62
|
+
export declare class TreeExecutor {
|
|
63
|
+
private publishedVersions;
|
|
64
|
+
private executionContext;
|
|
65
|
+
private stateMutex;
|
|
66
|
+
private commands;
|
|
67
|
+
private logger;
|
|
68
|
+
constructor(options?: TreeExecutorOptions);
|
|
69
|
+
/**
|
|
70
|
+
* Get published versions (thread-safe)
|
|
71
|
+
*/
|
|
72
|
+
getPublishedVersions(): Promise<PublishedVersion[]>;
|
|
73
|
+
/**
|
|
74
|
+
* Add published version (thread-safe)
|
|
75
|
+
*/
|
|
76
|
+
addPublishedVersion(version: PublishedVersion): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Get execution context (thread-safe)
|
|
79
|
+
* Returns a deep copy to prevent external modifications
|
|
80
|
+
*/
|
|
81
|
+
getExecutionContext(): Promise<TreeExecutionContext | null>;
|
|
82
|
+
/**
|
|
83
|
+
* Set execution context (thread-safe)
|
|
84
|
+
*/
|
|
85
|
+
setExecutionContext(context: TreeExecutionContext | null): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Reset state (for testing)
|
|
88
|
+
*/
|
|
89
|
+
reset(): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Execute tree command
|
|
92
|
+
*
|
|
93
|
+
* This will be the main entry point, delegating to the execute function
|
|
94
|
+
* from tree.ts but with instance state instead of global state.
|
|
95
|
+
*
|
|
96
|
+
* @param config - Tree execution configuration
|
|
97
|
+
* @returns Result message
|
|
98
|
+
*/
|
|
99
|
+
execute(config: TreeExecutionConfig): Promise<string>;
|
|
100
|
+
/**
|
|
101
|
+
* Get command executor
|
|
102
|
+
*/
|
|
103
|
+
getCommand(name: keyof CommandRegistry): CommandExecutor | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Set command executor (for testing/injection)
|
|
106
|
+
*/
|
|
107
|
+
setCommand(name: keyof CommandRegistry, executor: CommandExecutor): void;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Create a default TreeExecutor instance
|
|
111
|
+
*/
|
|
112
|
+
export declare function createTreeExecutor(options?: TreeExecutorOptions): TreeExecutor;
|
|
113
|
+
//# sourceMappingURL=TreeExecutor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeExecutor.d.ts","sourceRoot":"","sources":["../src/TreeExecutor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,IAAI,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,mBAAmB,CAAC;IACpC,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,EAAE,IAAI,CAAC;IAChB,cAAc,EAAE,IAAI,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,OAAO,CAAC,MAAM,EAAE,mBAAmB,EAAE,IAAI,CAAC,EAAE,MAA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I;CAG3E;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,YAAY,CAE9E"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TreeExecutor - Class-based tree command orchestration
|
|
3
|
+
*
|
|
4
|
+
* Refactored from tree.ts to use instance state instead of global state
|
|
5
|
+
* and dependency injection for commands.
|
|
6
|
+
*/
|
|
7
|
+
import { SimpleMutex } from './util/mutex.js';
|
|
8
|
+
/**
|
|
9
|
+
* TreeExecutor - Orchestrates tree command execution
|
|
10
|
+
*
|
|
11
|
+
* This class encapsulates all state that was previously global,
|
|
12
|
+
* making it testable and allowing multiple concurrent executions.
|
|
13
|
+
*/
|
|
14
|
+
export class TreeExecutor {
|
|
15
|
+
// Instance state (previously global)
|
|
16
|
+
publishedVersions = [];
|
|
17
|
+
executionContext = null;
|
|
18
|
+
stateMutex;
|
|
19
|
+
// Dependency injection
|
|
20
|
+
commands;
|
|
21
|
+
logger;
|
|
22
|
+
constructor(options = {}) {
|
|
23
|
+
this.commands = options.commands || {};
|
|
24
|
+
this.logger = options.logger;
|
|
25
|
+
this.stateMutex = new SimpleMutex();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get published versions (thread-safe)
|
|
29
|
+
*/
|
|
30
|
+
async getPublishedVersions() {
|
|
31
|
+
return await this.stateMutex.runExclusive(async () => {
|
|
32
|
+
return [...this.publishedVersions];
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Add published version (thread-safe)
|
|
37
|
+
*/
|
|
38
|
+
async addPublishedVersion(version) {
|
|
39
|
+
await this.stateMutex.runExclusive(async () => {
|
|
40
|
+
this.publishedVersions.push(version);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get execution context (thread-safe)
|
|
45
|
+
* Returns a deep copy to prevent external modifications
|
|
46
|
+
*/
|
|
47
|
+
async getExecutionContext() {
|
|
48
|
+
return await this.stateMutex.runExclusive(async () => {
|
|
49
|
+
if (!this.executionContext)
|
|
50
|
+
return null;
|
|
51
|
+
// Return deep copy to prevent external modification
|
|
52
|
+
return {
|
|
53
|
+
...this.executionContext,
|
|
54
|
+
publishedVersions: [...this.executionContext.publishedVersions],
|
|
55
|
+
completedPackages: [...this.executionContext.completedPackages],
|
|
56
|
+
buildOrder: [...this.executionContext.buildOrder]
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Set execution context (thread-safe)
|
|
62
|
+
*/
|
|
63
|
+
async setExecutionContext(context) {
|
|
64
|
+
await this.stateMutex.runExclusive(async () => {
|
|
65
|
+
this.executionContext = context;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Reset state (for testing)
|
|
70
|
+
*/
|
|
71
|
+
async reset() {
|
|
72
|
+
await this.stateMutex.runExclusive(async () => {
|
|
73
|
+
this.publishedVersions = [];
|
|
74
|
+
this.executionContext = null;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Execute tree command
|
|
79
|
+
*
|
|
80
|
+
* This will be the main entry point, delegating to the execute function
|
|
81
|
+
* from tree.ts but with instance state instead of global state.
|
|
82
|
+
*
|
|
83
|
+
* @param config - Tree execution configuration
|
|
84
|
+
* @returns Result message
|
|
85
|
+
*/
|
|
86
|
+
async execute(config) {
|
|
87
|
+
// Import the execute function from tree.ts
|
|
88
|
+
// We'll need to refactor tree.ts to accept TreeExecutor instance
|
|
89
|
+
const { execute } = await import('./tree.js');
|
|
90
|
+
// For now, this is a placeholder
|
|
91
|
+
// We'll refactor tree.ts to accept TreeExecutor in the next step
|
|
92
|
+
return await execute(config);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get command executor
|
|
96
|
+
*/
|
|
97
|
+
getCommand(name) {
|
|
98
|
+
return this.commands[name];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Set command executor (for testing/injection)
|
|
102
|
+
*/
|
|
103
|
+
setCommand(name, executor) {
|
|
104
|
+
this.commands[name] = executor;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Create a default TreeExecutor instance
|
|
109
|
+
*/
|
|
110
|
+
export function createTreeExecutor(options) {
|
|
111
|
+
return new TreeExecutor(options);
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=TreeExecutor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeExecutor.js","sourceRoot":"","sources":["../src/TreeExecutor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAwD9C;;;;;GAKG;AACH,MAAM,OAAO,YAAY;IACrB,qCAAqC;IAC7B,iBAAiB,GAAuB,EAAE,CAAC;IAC3C,gBAAgB,GAAgC,IAAI,CAAC;IACrD,UAAU,CAAc;IAEhC,uBAAuB;IACf,QAAQ,CAAkB;IAC1B,MAAM,CAAM;IAEpB,YAAY,UAA+B,EAAE;QACzC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,IAAI,WAAW,EAAE,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,oBAAoB;QACtB,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK,IAAI,EAAE;YACjD,OAAO,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB,CAAC,OAAyB;QAC/C,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK,IAAI,EAAE;YAC1C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AC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,IAA2B;QAClC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,IAA2B,EAAE,QAAyB;QAC7D,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;IACnC,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAA6B;IAC5D,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ParallelExecutionCheckpoint } from '../types/index.js';
|
|
2
|
+
export declare class CheckpointManager {
|
|
3
|
+
private checkpointPath;
|
|
4
|
+
private lockPath;
|
|
5
|
+
private tempPath;
|
|
6
|
+
private logger;
|
|
7
|
+
private storage;
|
|
8
|
+
constructor(outputDirectory?: string);
|
|
9
|
+
save(checkpoint: ParallelExecutionCheckpoint): Promise<void>;
|
|
10
|
+
load(): Promise<ParallelExecutionCheckpoint | null>;
|
|
11
|
+
backup(): Promise<void>;
|
|
12
|
+
cleanup(): Promise<void>;
|
|
13
|
+
private acquireLock;
|
|
14
|
+
private validateCheckpoint;
|
|
15
|
+
private isCompatibleVersion;
|
|
16
|
+
private loadBackup;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=CheckpointManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckpointManager.d.ts","sourceRoot":"","sources":["../../src/checkpoint/CheckpointManager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AASrE,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,OAAO,CAAmB;gBAEtB,eAAe,GAAE,MAAsB;IAM7C,IAAI,CAAC,UAAU,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB5D,IAAI,IAAI,OAAO,CAAC,2BAA2B,GAAG,IAAI,CAAC;IAoCnD,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IASvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAahB,WAAW;IAqCzB,OAAO,CAAC,kBAAkB;IAwB1B,OAAO,CAAC,mBAAmB;YAOb,UAAU;CAa3B"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs/promises';
|
|
3
|
+
import { getLogger } from '../util/logger.js';
|
|
4
|
+
import { createStorage } from '@eldrforge/shared';
|
|
5
|
+
const CHECKPOINT_VERSION = '1.0.0';
|
|
6
|
+
export class CheckpointManager {
|
|
7
|
+
checkpointPath;
|
|
8
|
+
lockPath;
|
|
9
|
+
tempPath;
|
|
10
|
+
logger = getLogger();
|
|
11
|
+
storage = createStorage();
|
|
12
|
+
constructor(outputDirectory = process.cwd()) {
|
|
13
|
+
this.checkpointPath = path.join(outputDirectory, '.kodrdriv-parallel-context.json');
|
|
14
|
+
this.lockPath = `${this.checkpointPath}.lock`;
|
|
15
|
+
this.tempPath = `${this.checkpointPath}.tmp`;
|
|
16
|
+
}
|
|
17
|
+
async save(checkpoint) {
|
|
18
|
+
const lock = await this.acquireLock();
|
|
19
|
+
try {
|
|
20
|
+
// Set version and timestamp
|
|
21
|
+
checkpoint.version = CHECKPOINT_VERSION;
|
|
22
|
+
checkpoint.lastUpdated = new Date().toISOString();
|
|
23
|
+
// Validate before saving
|
|
24
|
+
this.validateCheckpoint(checkpoint);
|
|
25
|
+
// Write to temp file
|
|
26
|
+
const serialized = JSON.stringify(checkpoint, null, 2);
|
|
27
|
+
await fs.writeFile(this.tempPath, serialized, 'utf-8');
|
|
28
|
+
// Atomic rename
|
|
29
|
+
await fs.rename(this.tempPath, this.checkpointPath);
|
|
30
|
+
this.logger.debug(`Checkpoint saved: ${this.checkpointPath}`);
|
|
31
|
+
}
|
|
32
|
+
finally {
|
|
33
|
+
await lock.release();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async load() {
|
|
37
|
+
if (!await this.storage.exists(this.checkpointPath)) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const lock = await this.acquireLock();
|
|
41
|
+
try {
|
|
42
|
+
const content = await fs.readFile(this.checkpointPath, 'utf-8');
|
|
43
|
+
const checkpoint = JSON.parse(content);
|
|
44
|
+
// Validate
|
|
45
|
+
this.validateCheckpoint(checkpoint);
|
|
46
|
+
// Check version
|
|
47
|
+
if (!this.isCompatibleVersion(checkpoint.version)) {
|
|
48
|
+
throw new Error(`Incompatible checkpoint version: ${checkpoint.version}`);
|
|
49
|
+
}
|
|
50
|
+
return checkpoint;
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
this.logger.error(`CHECKPOINT_LOAD_FAILED: Failed to load checkpoint file | Error: ${error.message} | Impact: Cannot resume execution`);
|
|
54
|
+
// Try backup
|
|
55
|
+
const backup = await this.loadBackup();
|
|
56
|
+
if (backup) {
|
|
57
|
+
this.logger.info('CHECKPOINT_RECOVERED_BACKUP: Recovered from backup checkpoint | Source: backup | Status: loaded');
|
|
58
|
+
return backup;
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
await lock.release();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async backup() {
|
|
67
|
+
if (!await this.storage.exists(this.checkpointPath)) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const backupPath = `${this.checkpointPath}.backup`;
|
|
71
|
+
await fs.copyFile(this.checkpointPath, backupPath);
|
|
72
|
+
}
|
|
73
|
+
async cleanup() {
|
|
74
|
+
const files = [
|
|
75
|
+
this.checkpointPath,
|
|
76
|
+
this.lockPath,
|
|
77
|
+
this.tempPath,
|
|
78
|
+
`${this.checkpointPath}.backup`
|
|
79
|
+
];
|
|
80
|
+
await Promise.all(files.map(file => fs.unlink(file).catch(() => { })));
|
|
81
|
+
}
|
|
82
|
+
async acquireLock() {
|
|
83
|
+
const maxWaitMs = 30000;
|
|
84
|
+
const startTime = Date.now();
|
|
85
|
+
while (true) {
|
|
86
|
+
try {
|
|
87
|
+
const fileHandle = await fs.open(this.lockPath, 'wx');
|
|
88
|
+
try {
|
|
89
|
+
const pid = process.pid;
|
|
90
|
+
const timestamp = new Date().toISOString();
|
|
91
|
+
await fileHandle.writeFile(`${pid}\n${timestamp}`);
|
|
92
|
+
}
|
|
93
|
+
finally {
|
|
94
|
+
await fileHandle.close();
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
release: async () => {
|
|
98
|
+
await fs.unlink(this.lockPath).catch(() => { });
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (error.code !== 'EEXIST') {
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
const elapsed = Date.now() - startTime;
|
|
107
|
+
if (elapsed > maxWaitMs) {
|
|
108
|
+
this.logger.warn('CHECKPOINT_LOCK_STALE: Breaking stale checkpoint lock | Reason: Lock expired | Action: Force break lock');
|
|
109
|
+
await fs.unlink(this.lockPath).catch(() => { });
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
validateCheckpoint(checkpoint) {
|
|
117
|
+
if (!checkpoint.executionId) {
|
|
118
|
+
throw new Error('Invalid checkpoint: missing executionId');
|
|
119
|
+
}
|
|
120
|
+
if (!checkpoint.state) {
|
|
121
|
+
throw new Error('Invalid checkpoint: missing state');
|
|
122
|
+
}
|
|
123
|
+
// Validate state consistency
|
|
124
|
+
const allPackages = new Set([
|
|
125
|
+
...checkpoint.state.pending,
|
|
126
|
+
...checkpoint.state.ready,
|
|
127
|
+
...checkpoint.state.running.map(r => r.name),
|
|
128
|
+
...checkpoint.state.completed,
|
|
129
|
+
...checkpoint.state.failed.map(f => f.name),
|
|
130
|
+
...checkpoint.state.skipped
|
|
131
|
+
]);
|
|
132
|
+
if (allPackages.size !== checkpoint.buildOrder.length) {
|
|
133
|
+
this.logger.warn('CHECKPOINT_INCONSISTENCY: Checkpoint state inconsistency detected | Issue: State validation failed | Impact: May need manual recovery');
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
isCompatibleVersion(version) {
|
|
137
|
+
// Simple major version check
|
|
138
|
+
const [major] = version.split('.');
|
|
139
|
+
const [expectedMajor] = CHECKPOINT_VERSION.split('.');
|
|
140
|
+
return major === expectedMajor;
|
|
141
|
+
}
|
|
142
|
+
async loadBackup() {
|
|
143
|
+
const backupPath = `${this.checkpointPath}.backup`;
|
|
144
|
+
if (!await this.storage.exists(backupPath)) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
try {
|
|
148
|
+
const content = await fs.readFile(backupPath, 'utf-8');
|
|
149
|
+
return JSON.parse(content);
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=CheckpointManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckpointManager.js","sourceRoot":"","sources":["../../src/checkpoint/CheckpointManager.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAMn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G,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;YAC3C,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO;SAC9B,CAAC,CAAC;QAEH,IAAI,WAAW,CAAC,IAAI,KAAK,UAAU,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YACpD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,uIAAuI,CAAC,CAAC;QAC9J,CAAC;IACL,CAAC;IAEO,mBAAmB,CAAC,OAAe;QACvC,6BAA6B;QAC7B,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnC,MAAM,CAAC,aAAa,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtD,OAAO,KAAK,KAAK,aAAa,CAAC;IACnC,CAAC;IAEO,KAAK,CAAC,UAAU;QACpB,MAAM,UAAU,GAAG,GAAG,IAAI,CAAC,cAAc,SAAS,CAAC;QACnD,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;YACzC,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,IAAI,CAAC;YACD,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YACvD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAgC,CAAC;QAC9D,CAAC;QAAC,MAAM,CAAC;YACL,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/checkpoint/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/checkpoint/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ValidationResult {
|
|
2
|
+
valid: boolean;
|
|
3
|
+
issues: string[];
|
|
4
|
+
warnings: string[];
|
|
5
|
+
recommendations: string[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* CommandValidator checks if commands are safe for parallel execution
|
|
9
|
+
*/
|
|
10
|
+
export declare class CommandValidator {
|
|
11
|
+
private static logger;
|
|
12
|
+
/**
|
|
13
|
+
* Validate a command for parallel execution
|
|
14
|
+
*/
|
|
15
|
+
static validateForParallel(command: string, builtInCommand?: string): ValidationResult;
|
|
16
|
+
/**
|
|
17
|
+
* Log validation results
|
|
18
|
+
*/
|
|
19
|
+
static logValidation(result: ValidationResult): void;
|
|
20
|
+
/**
|
|
21
|
+
* Get recommended concurrency for a command type
|
|
22
|
+
*/
|
|
23
|
+
static getRecommendedConcurrency(builtInCommand?: string, cpuCount?: number, command?: string): number;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=CommandValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandValidator.d.ts","sourceRoot":"","sources":["../../src/execution/CommandValidator.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,qBAAa,gBAAgB;IACzB,OAAO,CAAC,MAAM,CAAC,MAAM,CAAe;IAEpC;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,gBAAgB;IAoEtF;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAuBpD;;OAEG;IACH,MAAM,CAAC,yBAAyB,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAU,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;CAuC5G"}
|