@symbeon/orbit-devops 1.3.1 → 1.4.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.
|
@@ -28,10 +28,11 @@ To reclaim space safely:
|
|
|
28
28
|
2. Clean `npm-cache` using `npm cache clean --force` if large Node.js footprints are detected.
|
|
29
29
|
3. Use `scripts/wsl/CompactWSL.ps1` (requires admin) to "squeeze" WSL2 virtual disks.
|
|
30
30
|
|
|
31
|
-
### 3. Environment DNA Management
|
|
31
|
+
### 3. Environment DNA Management & Genome Integration
|
|
32
32
|
To ensure a portable and safe environment:
|
|
33
33
|
1. Use `scripts/stack/SnapshotEnv.ps1` to generate a local `dev-stack.json`.
|
|
34
|
-
2.
|
|
34
|
+
2. Access the **Genome Library** via the [agent-stack-dev](https://github.com/SH1W4/agent-stack-dev) skill to pull standardized Agent DNAs.
|
|
35
|
+
3. Apply adaptive provisioning rules from `logic/` to mutate the environment based on machine constraints.
|
|
35
36
|
|
|
36
37
|
## Capabilities Mapping
|
|
37
38
|
|
package/bin/orbit.js
CHANGED
|
@@ -1,95 +1,87 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
1
|
import { Command } from 'commander';
|
|
4
2
|
import chalk from 'chalk';
|
|
5
|
-
import spawn from 'cross-spawn';
|
|
6
3
|
import path from 'path';
|
|
7
4
|
import { fileURLToPath } from 'url';
|
|
5
|
+
import os from 'os';
|
|
6
|
+
|
|
7
|
+
// Providers
|
|
8
|
+
import WindowsProvider from '../providers/WindowsProvider.js';
|
|
9
|
+
import UnixProvider from '../providers/UnixProvider.js';
|
|
8
10
|
|
|
9
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
12
|
const __dirname = path.dirname(__filename);
|
|
11
13
|
const PROJECT_ROOT = path.join(__dirname, '..');
|
|
12
14
|
|
|
15
|
+
// Platform Detection & Provider Initialization
|
|
16
|
+
let provider;
|
|
17
|
+
const platform = os.platform();
|
|
18
|
+
|
|
19
|
+
if (platform === 'win32') {
|
|
20
|
+
provider = new WindowsProvider(PROJECT_ROOT);
|
|
21
|
+
} else if (platform === 'linux' || platform === 'darwin') {
|
|
22
|
+
provider = new UnixProvider(PROJECT_ROOT);
|
|
23
|
+
} else {
|
|
24
|
+
console.error(chalk.red(`\n❌ Error: Unsupported platform: ${platform}`));
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
|
|
13
28
|
const program = new Command();
|
|
14
29
|
|
|
15
30
|
program
|
|
16
31
|
.name('orbit')
|
|
17
32
|
.description('Orbit-DevOps: The Developer\'s Workspace Command Center')
|
|
18
|
-
.version('1.
|
|
19
|
-
|
|
20
|
-
import fs from 'fs';
|
|
21
|
-
|
|
22
|
-
// ... (previous imports)
|
|
23
|
-
|
|
24
|
-
// Helper to run PowerShell scripts
|
|
25
|
-
function runScript(scriptPath, args = []) {
|
|
26
|
-
// Safe path resolution for Windows
|
|
27
|
-
const fullPath = path.normalize(path.resolve(PROJECT_ROOT, scriptPath));
|
|
28
|
-
|
|
29
|
-
if (!fs.existsSync(fullPath)) {
|
|
30
|
-
console.error(chalk.red(`\n❌ Error: Script not found at: ${fullPath}`));
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
console.log(chalk.blue(`\n🚀 Orbit Launching: ${path.basename(fullPath)}...`));
|
|
35
|
-
|
|
36
|
-
// Don't manually quote the path; spawn handles it if we don't use windowsVerbatimArgumentsor specific shell options
|
|
37
|
-
const child = spawn('powershell.exe', ['-ExecutionPolicy', 'Bypass', '-File', fullPath, ...args], {
|
|
38
|
-
stdio: 'inherit'
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
child.on('close', (code) => {
|
|
42
|
-
if (code === 0) {
|
|
43
|
-
console.log(chalk.green(`\n✅ Mission Complete (Exit Code: ${code})`));
|
|
44
|
-
} else {
|
|
45
|
-
console.log(chalk.red(`\n❌ Mission Failed (Exit Code: ${code})`));
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
33
|
+
.version('1.4.0');
|
|
49
34
|
|
|
50
35
|
// --- Commands ---
|
|
51
36
|
|
|
52
37
|
program
|
|
53
38
|
.command('doctor')
|
|
54
39
|
.description('Run a full system diagnostic health check')
|
|
55
|
-
.action(() => {
|
|
56
|
-
runScript('scripts/diagnostic/SystemDiagnosticUser_v2.ps1');
|
|
40
|
+
.action(async () => {
|
|
41
|
+
await provider.runScript('Diagnostic', 'scripts/diagnostic/SystemDiagnosticUser_v2.ps1');
|
|
57
42
|
});
|
|
58
43
|
|
|
59
44
|
program
|
|
60
45
|
.command('space')
|
|
61
46
|
.description('Analyze disk usage and find hotspots')
|
|
62
|
-
.action(() => {
|
|
63
|
-
runScript('scripts/diagnostic/ScanStorage.ps1');
|
|
47
|
+
.action(async () => {
|
|
48
|
+
await provider.runScript('Storage Analysis', 'scripts/diagnostic/ScanStorage.ps1');
|
|
64
49
|
});
|
|
65
50
|
|
|
66
51
|
program
|
|
67
52
|
.command('clean')
|
|
68
53
|
.description('Perform safe system and dev-tool cleanup')
|
|
69
|
-
.action(() => {
|
|
70
|
-
runScript('scripts/cleanup/AdditionalCleanup.ps1');
|
|
54
|
+
.action(async () => {
|
|
55
|
+
await provider.runScript('Cleanup', 'scripts/cleanup/AdditionalCleanup.ps1');
|
|
71
56
|
});
|
|
72
57
|
|
|
73
58
|
program
|
|
74
59
|
.command('compact')
|
|
75
60
|
.description('Compact WSL2 virtual disks manually (requires Admin)')
|
|
76
|
-
.action(() => {
|
|
77
|
-
|
|
78
|
-
|
|
61
|
+
.action(async () => {
|
|
62
|
+
if (platform !== 'win32') {
|
|
63
|
+
console.error(chalk.yellow('\n⚠️ Note: WSL2 compaction is only available on Windows.'));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
await provider.runScript('WSL Compaction', 'scripts/wsl/CompactWSL.ps1');
|
|
79
67
|
});
|
|
80
68
|
|
|
81
69
|
program
|
|
82
70
|
.command('sync')
|
|
83
|
-
.description('Sync environment stack to GitHub
|
|
84
|
-
.action(() => {
|
|
85
|
-
runScript('scripts/stack/Push-Stack.ps1');
|
|
71
|
+
.description('Sync environment stack to GitHub')
|
|
72
|
+
.action(async () => {
|
|
73
|
+
await provider.runScript('Stack Sync', 'scripts/stack/Push-Stack.ps1');
|
|
86
74
|
});
|
|
87
75
|
|
|
88
76
|
program
|
|
89
77
|
.command('menu')
|
|
90
78
|
.description('Launch the interactive PowerShell menu (Legacy)')
|
|
91
|
-
.action(() => {
|
|
92
|
-
|
|
79
|
+
.action(async () => {
|
|
80
|
+
if (platform !== 'win32') {
|
|
81
|
+
console.error(chalk.yellow('\n⚠️ Note: The interactive menu is currently Windows-only.'));
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
await provider.runScript('Legacy Menu', 'scripts/core/Orbit.ps1');
|
|
93
85
|
});
|
|
94
86
|
|
|
95
87
|
program.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
|
|
3
|
+
export default class BaseProvider {
|
|
4
|
+
constructor(projectRoot) {
|
|
5
|
+
this.projectRoot = projectRoot;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Run a platform-specific command or script.
|
|
10
|
+
* @param {string} taskName Name of the task
|
|
11
|
+
* @param {string} scriptPath Relative path to the script
|
|
12
|
+
* @param {Array} args Arguments for the script
|
|
13
|
+
*/
|
|
14
|
+
async runScript(taskName, scriptPath, args = []) {
|
|
15
|
+
throw new Error('runScript() must be implemented by the provider');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
logInfo(message) {
|
|
19
|
+
console.log(chalk.blue(`\n🚀 Orbit [${this.getName()}]: ${message}`));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
logSuccess(message) {
|
|
23
|
+
console.log(chalk.green(`\n✅ ${message}`));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
logError(message) {
|
|
27
|
+
console.error(chalk.red(`\n❌ Error [${this.getName()}]: ${message}`));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
getName() {
|
|
31
|
+
return 'Base';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BaseProvider from './BaseProvider.js';
|
|
2
|
+
|
|
3
|
+
export default class UnixProvider extends BaseProvider {
|
|
4
|
+
/**
|
|
5
|
+
* Run a Bash/Shell script.
|
|
6
|
+
*/
|
|
7
|
+
async runScript(taskName, scriptPath, args = []) {
|
|
8
|
+
this.logInfo(`(PREVIEW) Launching Unix command (Linux/macOS): ${scriptPath}...`);
|
|
9
|
+
|
|
10
|
+
// In the future, this will map to .sh scripts or python scripts
|
|
11
|
+
this.logError(`Unix implementation for ${scriptPath} is coming soon in Phase 2.`);
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getName() {
|
|
16
|
+
return 'Unix (Linux/macOS)';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import spawn from 'cross-spawn';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import BaseProvider from './BaseProvider.js';
|
|
5
|
+
|
|
6
|
+
export default class WindowsProvider extends BaseProvider {
|
|
7
|
+
/**
|
|
8
|
+
* Run a PowerShell script.
|
|
9
|
+
*/
|
|
10
|
+
async runScript(taskName, scriptPath, args = []) {
|
|
11
|
+
const fullPath = path.normalize(path.resolve(this.projectRoot, scriptPath));
|
|
12
|
+
|
|
13
|
+
if (!fs.existsSync(fullPath)) {
|
|
14
|
+
this.logError(`Script not found at: ${fullPath}`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
this.logInfo(`Launching: ${path.basename(fullPath)}...`);
|
|
19
|
+
|
|
20
|
+
return new Promise((resolve) => {
|
|
21
|
+
const child = spawn('powershell.exe', [
|
|
22
|
+
'-ExecutionPolicy', 'Bypass',
|
|
23
|
+
'-File', fullPath,
|
|
24
|
+
...args
|
|
25
|
+
], {
|
|
26
|
+
stdio: 'inherit'
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
child.on('close', (code) => {
|
|
30
|
+
if (code === 0) {
|
|
31
|
+
this.logSuccess(`Mission Complete (Exit Code: ${code})`);
|
|
32
|
+
resolve(true);
|
|
33
|
+
} else {
|
|
34
|
+
this.logError(`Mission Failed (Exit Code: ${code})`);
|
|
35
|
+
resolve(false);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
getName() {
|
|
42
|
+
return 'Windows';
|
|
43
|
+
}
|
|
44
|
+
}
|