@orchestree/cli 2.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/README.md +528 -0
- package/bin/orchestree.js +14 -0
- package/package.json +46 -0
- package/src/commands.js +848 -0
- package/src/index.d.ts +221 -0
- package/src/index.js +279 -0
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestree CLI - TypeScript Declarations
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Color codes for terminal output
|
|
7
|
+
*/
|
|
8
|
+
export interface Colors {
|
|
9
|
+
reset: string;
|
|
10
|
+
bright: string;
|
|
11
|
+
dim: string;
|
|
12
|
+
cyan: string;
|
|
13
|
+
green: string;
|
|
14
|
+
yellow: string;
|
|
15
|
+
red: string;
|
|
16
|
+
blue: string;
|
|
17
|
+
magenta: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* CLI configuration object
|
|
22
|
+
*/
|
|
23
|
+
export interface CLIConfig {
|
|
24
|
+
authenticated?: boolean;
|
|
25
|
+
workspace?: string;
|
|
26
|
+
userId?: string;
|
|
27
|
+
debug?: boolean;
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Parsed command-line arguments
|
|
33
|
+
*/
|
|
34
|
+
export interface ParsedArgs {
|
|
35
|
+
command: string | null;
|
|
36
|
+
subcommand: string | null;
|
|
37
|
+
args: string[];
|
|
38
|
+
flags: Record<string, string | boolean>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Context passed to command handlers
|
|
43
|
+
*/
|
|
44
|
+
export interface CommandContext {
|
|
45
|
+
cli: OrchestreeCLI;
|
|
46
|
+
flags: Record<string, string | boolean>;
|
|
47
|
+
args: string[];
|
|
48
|
+
verbose: boolean;
|
|
49
|
+
json: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Command handler function type
|
|
54
|
+
*/
|
|
55
|
+
export type CommandHandler = (subcommand: string | null, context: CommandContext) => Promise<void>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Main CLI class
|
|
59
|
+
*/
|
|
60
|
+
export class OrchestreeCLI {
|
|
61
|
+
version: string;
|
|
62
|
+
config: CLIConfig;
|
|
63
|
+
|
|
64
|
+
constructor();
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Get the CLI version
|
|
68
|
+
*/
|
|
69
|
+
getVersion(): string;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Load configuration from disk
|
|
73
|
+
*/
|
|
74
|
+
loadConfig(): CLIConfig;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Save configuration to disk
|
|
78
|
+
*/
|
|
79
|
+
saveConfig(): void;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Log a message with optional color
|
|
83
|
+
*/
|
|
84
|
+
log(message: string, color?: keyof Colors): void;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Log an error message
|
|
88
|
+
*/
|
|
89
|
+
error(message: string): void;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Log a success message
|
|
93
|
+
*/
|
|
94
|
+
success(message: string): void;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Log an info message
|
|
98
|
+
*/
|
|
99
|
+
info(message: string): void;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Log a warning message
|
|
103
|
+
*/
|
|
104
|
+
warn(message: string): void;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Display the welcome banner
|
|
108
|
+
*/
|
|
109
|
+
showBanner(): void;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Display the help menu
|
|
113
|
+
*/
|
|
114
|
+
showHelp(): void;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Display the version
|
|
118
|
+
*/
|
|
119
|
+
showVersion(): void;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Parse command-line arguments
|
|
123
|
+
*/
|
|
124
|
+
parseArgs(argv: string[]): ParsedArgs;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Run the CLI with given arguments
|
|
128
|
+
*/
|
|
129
|
+
run(argv: string[]): Promise<void>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Authentication commands
|
|
134
|
+
* - login: Log in to your Orchestree account
|
|
135
|
+
* - logout: Log out from Orchestree
|
|
136
|
+
* - status: Check authentication status
|
|
137
|
+
*/
|
|
138
|
+
export const auth: CommandHandler;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Workspace commands
|
|
142
|
+
* - list: List all workspaces
|
|
143
|
+
* - create <name>: Create a new workspace
|
|
144
|
+
* - switch <name>: Switch to a workspace
|
|
145
|
+
*/
|
|
146
|
+
export const workspace: CommandHandler;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Module management commands
|
|
150
|
+
* - list: List all available modules
|
|
151
|
+
* - enable <name>: Enable a module
|
|
152
|
+
* - status: Show module status
|
|
153
|
+
* - health: Check module health
|
|
154
|
+
*/
|
|
155
|
+
export const modules: CommandHandler;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Conductor workflow commands
|
|
159
|
+
* - workflows: List automation workflows
|
|
160
|
+
* - run <workflow>: Run a workflow
|
|
161
|
+
* - logs: View workflow logs
|
|
162
|
+
*/
|
|
163
|
+
export const conductor: CommandHandler;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Social media publishing commands
|
|
167
|
+
* - post <content>: Post to social media
|
|
168
|
+
* - schedule: Schedule a post
|
|
169
|
+
* - analytics: View social analytics
|
|
170
|
+
*/
|
|
171
|
+
export const social: CommandHandler;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Code generation commands
|
|
175
|
+
* - generate: Generate code with AI
|
|
176
|
+
* - review: AI code review
|
|
177
|
+
* - docs: Generate documentation
|
|
178
|
+
*/
|
|
179
|
+
export const codenza: CommandHandler;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Brand studio commands
|
|
183
|
+
* - create: Create branded assets
|
|
184
|
+
* - brand-kit: Manage brand kit
|
|
185
|
+
*/
|
|
186
|
+
export const forge: CommandHandler;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Module enhancement command
|
|
190
|
+
* - enhance <module>: Enhance any Orchestree module
|
|
191
|
+
*/
|
|
192
|
+
export const enhance: CommandHandler;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Code scaffolding commands
|
|
196
|
+
* - api-endpoint: Create API endpoint scaffold
|
|
197
|
+
* - new-module: Create new module scaffold
|
|
198
|
+
*/
|
|
199
|
+
export const scaffold: CommandHandler;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Audit command for system and code quality
|
|
203
|
+
* - --type ui|code|security|all
|
|
204
|
+
* - --module <name>
|
|
205
|
+
*/
|
|
206
|
+
export const audit: CommandHandler;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Test runner command
|
|
210
|
+
*/
|
|
211
|
+
export const test: CommandHandler;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Development commands
|
|
215
|
+
* - serve: Start development server
|
|
216
|
+
* - deploy: Deploy to staging
|
|
217
|
+
* - logs: View server logs
|
|
218
|
+
*/
|
|
219
|
+
export const dev: CommandHandler;
|
|
220
|
+
|
|
221
|
+
export default OrchestreeCLI;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Orchestree CLI - Main Entry Point
|
|
5
|
+
* Handles command parsing, dispatch, and top-level configuration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const commands = require('./commands');
|
|
11
|
+
|
|
12
|
+
// ANSI color codes for terminal output
|
|
13
|
+
const colors = {
|
|
14
|
+
reset: '\x1b[0m',
|
|
15
|
+
bright: '\x1b[1m',
|
|
16
|
+
dim: '\x1b[2m',
|
|
17
|
+
cyan: '\x1b[36m',
|
|
18
|
+
green: '\x1b[32m',
|
|
19
|
+
yellow: '\x1b[33m',
|
|
20
|
+
red: '\x1b[31m',
|
|
21
|
+
blue: '\x1b[34m',
|
|
22
|
+
magenta: '\x1b[35m',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
class OrchestreeCLI {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.version = this.getVersion();
|
|
28
|
+
this.config = this.loadConfig();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getVersion() {
|
|
32
|
+
try {
|
|
33
|
+
const packageJson = require('../package.json');
|
|
34
|
+
return packageJson.version;
|
|
35
|
+
} catch {
|
|
36
|
+
return '2.1.0';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
loadConfig() {
|
|
41
|
+
const configPath = path.join(process.env.HOME || process.env.USERPROFILE || '~', '.orchestree');
|
|
42
|
+
try {
|
|
43
|
+
if (fs.existsSync(configPath)) {
|
|
44
|
+
return JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
45
|
+
}
|
|
46
|
+
} catch (error) {
|
|
47
|
+
// Config file doesn't exist or is invalid, that's OK
|
|
48
|
+
}
|
|
49
|
+
return {};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
saveConfig() {
|
|
53
|
+
const configPath = path.join(process.env.HOME || process.env.USERPROFILE || '~', '.orchestree');
|
|
54
|
+
try {
|
|
55
|
+
fs.writeFileSync(configPath, JSON.stringify(this.config, null, 2), 'utf-8');
|
|
56
|
+
} catch (error) {
|
|
57
|
+
this.error(`Failed to save config: ${error.message}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
log(message, color = 'reset') {
|
|
62
|
+
console.log(`${colors[color]}${message}${colors.reset}`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
error(message) {
|
|
66
|
+
console.error(`${colors.red}✖ Error: ${message}${colors.reset}`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
success(message) {
|
|
70
|
+
console.log(`${colors.green}✓ ${message}${colors.reset}`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
info(message) {
|
|
74
|
+
console.log(`${colors.cyan}ℹ ${message}${colors.reset}`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
warn(message) {
|
|
78
|
+
console.log(`${colors.yellow}⚠ ${message}${colors.reset}`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
showBanner() {
|
|
82
|
+
this.log('', 'reset');
|
|
83
|
+
this.log(' ╔═══════════════════════════════════════╗', 'cyan');
|
|
84
|
+
this.log(' ║ ║', 'cyan');
|
|
85
|
+
this.log(' ║ 🚀 ORCHESTREE CLI v' + this.version.padEnd(20) + '║', 'cyan');
|
|
86
|
+
this.log(' ║ Intelligent Automation Platform ║', 'cyan');
|
|
87
|
+
this.log(' ║ ║', 'cyan');
|
|
88
|
+
this.log(' ╚═══════════════════════════════════════╝', 'cyan');
|
|
89
|
+
this.log('', 'reset');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
showHelp() {
|
|
93
|
+
this.showBanner();
|
|
94
|
+
this.log(`${colors.bright}Usage:${colors.reset}`, 'reset');
|
|
95
|
+
this.log(' orchestree <command> [options]', 'reset');
|
|
96
|
+
this.log('', 'reset');
|
|
97
|
+
|
|
98
|
+
this.log(`${colors.bright}Commands:${colors.reset}`, 'reset');
|
|
99
|
+
this.log('', 'reset');
|
|
100
|
+
|
|
101
|
+
this.log(' Authentication:', 'blue');
|
|
102
|
+
this.log(' auth login Log in to your Orchestree account', 'reset');
|
|
103
|
+
this.log(' auth logout Log out from Orchestree', 'reset');
|
|
104
|
+
this.log(' auth status Check authentication status', 'reset');
|
|
105
|
+
this.log('', 'reset');
|
|
106
|
+
|
|
107
|
+
this.log(' Workspace:', 'blue');
|
|
108
|
+
this.log(' workspace list List all workspaces', 'reset');
|
|
109
|
+
this.log(' workspace create <name> Create a new workspace', 'reset');
|
|
110
|
+
this.log(' workspace switch <name> Switch to a workspace', 'reset');
|
|
111
|
+
this.log('', 'reset');
|
|
112
|
+
|
|
113
|
+
this.log(' Modules:', 'blue');
|
|
114
|
+
this.log(' modules list List all available modules', 'reset');
|
|
115
|
+
this.log(' modules enable <name> Enable a module', 'reset');
|
|
116
|
+
this.log(' modules status Show module status', 'reset');
|
|
117
|
+
this.log(' modules health Check module health', 'reset');
|
|
118
|
+
this.log('', 'reset');
|
|
119
|
+
|
|
120
|
+
this.log(' Conductor (Workflows):', 'blue');
|
|
121
|
+
this.log(' conductor workflows List automation workflows', 'reset');
|
|
122
|
+
this.log(' conductor run <workflow> Run a workflow', 'reset');
|
|
123
|
+
this.log(' conductor logs View workflow logs', 'reset');
|
|
124
|
+
this.log('', 'reset');
|
|
125
|
+
|
|
126
|
+
this.log(' Social (Publishing):', 'blue');
|
|
127
|
+
this.log(' social post <content> Post to social media', 'reset');
|
|
128
|
+
this.log(' social schedule Schedule a post', 'reset');
|
|
129
|
+
this.log(' social analytics View social analytics', 'reset');
|
|
130
|
+
this.log('', 'reset');
|
|
131
|
+
|
|
132
|
+
this.log(' Codenza (Code Generation):', 'blue');
|
|
133
|
+
this.log(' codenza generate Generate code', 'reset');
|
|
134
|
+
this.log(' codenza review AI code review', 'reset');
|
|
135
|
+
this.log(' codenza docs Generate documentation', 'reset');
|
|
136
|
+
this.log('', 'reset');
|
|
137
|
+
|
|
138
|
+
this.log(' Forge (Brand Studio):', 'blue');
|
|
139
|
+
this.log(' forge create Create branded assets', 'reset');
|
|
140
|
+
this.log(' forge brand-kit Manage brand kit', 'reset');
|
|
141
|
+
this.log('', 'reset');
|
|
142
|
+
|
|
143
|
+
this.log(' Enhance (Module Optimization):', 'blue');
|
|
144
|
+
this.log(' enhance [module] Enhance any Orchestree module', 'reset');
|
|
145
|
+
this.log('', 'reset');
|
|
146
|
+
|
|
147
|
+
this.log(' Development:', 'blue');
|
|
148
|
+
this.log(' scaffold api-endpoint Create API endpoint scaffold', 'reset');
|
|
149
|
+
this.log(' scaffold new-module Create new module scaffold', 'reset');
|
|
150
|
+
this.log(' audit [options] Audit system & code quality', 'reset');
|
|
151
|
+
this.log(' test Run tests', 'reset');
|
|
152
|
+
this.log(' dev serve Start development server', 'reset');
|
|
153
|
+
this.log(' dev deploy Deploy to staging', 'reset');
|
|
154
|
+
this.log(' dev logs View server logs', 'reset');
|
|
155
|
+
this.log('', 'reset');
|
|
156
|
+
|
|
157
|
+
this.log(`${colors.bright}Options:${colors.reset}`, 'reset');
|
|
158
|
+
this.log(' -h, --help Display this help menu', 'reset');
|
|
159
|
+
this.log(' -v, --version Show version number', 'reset');
|
|
160
|
+
this.log(' --verbose Enable verbose logging', 'reset');
|
|
161
|
+
this.log(' --json Output as JSON', 'reset');
|
|
162
|
+
this.log('', 'reset');
|
|
163
|
+
|
|
164
|
+
this.log(`${colors.bright}Examples:${colors.reset}`, 'reset');
|
|
165
|
+
this.log(' orchestree auth login', 'reset');
|
|
166
|
+
this.log(' orchestree workspace create my-workspace', 'reset');
|
|
167
|
+
this.log(' orchestree modules list', 'reset');
|
|
168
|
+
this.log(' orchestree conductor run daily-sync', 'reset');
|
|
169
|
+
this.log(' orchestree enhance social', 'reset');
|
|
170
|
+
this.log(' orchestree dev serve', 'reset');
|
|
171
|
+
this.log('', 'reset');
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
showVersion() {
|
|
175
|
+
this.log(`Orchestree CLI v${this.version}`, 'cyan');
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
parseArgs(argv) {
|
|
179
|
+
const args = argv.slice(2);
|
|
180
|
+
const parsed = {
|
|
181
|
+
command: null,
|
|
182
|
+
subcommand: null,
|
|
183
|
+
args: [],
|
|
184
|
+
flags: {},
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
let i = 0;
|
|
188
|
+
while (i < args.length) {
|
|
189
|
+
const arg = args[i];
|
|
190
|
+
|
|
191
|
+
if (arg.startsWith('--')) {
|
|
192
|
+
const key = arg.slice(2);
|
|
193
|
+
const next = args[i + 1];
|
|
194
|
+
if (next && !next.startsWith('-')) {
|
|
195
|
+
parsed.flags[key] = next;
|
|
196
|
+
i += 2;
|
|
197
|
+
} else {
|
|
198
|
+
parsed.flags[key] = true;
|
|
199
|
+
i += 1;
|
|
200
|
+
}
|
|
201
|
+
} else if (arg.startsWith('-') && arg !== '-') {
|
|
202
|
+
const key = arg.slice(1);
|
|
203
|
+
parsed.flags[key] = true;
|
|
204
|
+
i += 1;
|
|
205
|
+
} else if (!parsed.command) {
|
|
206
|
+
parsed.command = arg;
|
|
207
|
+
i += 1;
|
|
208
|
+
} else if (!parsed.subcommand) {
|
|
209
|
+
parsed.subcommand = arg;
|
|
210
|
+
i += 1;
|
|
211
|
+
} else {
|
|
212
|
+
parsed.args.push(arg);
|
|
213
|
+
i += 1;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return parsed;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
async run(argv) {
|
|
221
|
+
const parsed = this.parseArgs(argv);
|
|
222
|
+
|
|
223
|
+
// Handle global flags
|
|
224
|
+
if (parsed.flags.h || parsed.flags.help) {
|
|
225
|
+
this.showHelp();
|
|
226
|
+
process.exit(0);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (parsed.flags.v || parsed.flags.version) {
|
|
230
|
+
this.showVersion();
|
|
231
|
+
process.exit(0);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// If no command, show help
|
|
235
|
+
if (!parsed.command) {
|
|
236
|
+
this.showHelp();
|
|
237
|
+
process.exit(0);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
try {
|
|
241
|
+
// Dispatch to command handler
|
|
242
|
+
const handler = commands[parsed.command];
|
|
243
|
+
|
|
244
|
+
if (!handler) {
|
|
245
|
+
this.error(`Unknown command: ${parsed.command}`);
|
|
246
|
+
this.log('\nRun "orchestree --help" for available commands', 'dim');
|
|
247
|
+
process.exit(1);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Pass context to handler
|
|
251
|
+
const context = {
|
|
252
|
+
cli: this,
|
|
253
|
+
flags: parsed.flags,
|
|
254
|
+
args: parsed.args,
|
|
255
|
+
verbose: parsed.flags.verbose || parsed.flags.V,
|
|
256
|
+
json: parsed.flags.json,
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
await handler(parsed.subcommand, context);
|
|
260
|
+
} catch (error) {
|
|
261
|
+
this.error(error.message);
|
|
262
|
+
if (this.config.debug) {
|
|
263
|
+
console.error(error);
|
|
264
|
+
}
|
|
265
|
+
process.exit(1);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// Main entry point
|
|
271
|
+
if (require.main === module) {
|
|
272
|
+
const cli = new OrchestreeCLI();
|
|
273
|
+
cli.run(process.argv).catch((error) => {
|
|
274
|
+
console.error(error);
|
|
275
|
+
process.exit(1);
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
module.exports = OrchestreeCLI;
|