-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli_index.py
More file actions
93 lines (75 loc) Β· 2.85 KB
/
cli_index.py
File metadata and controls
93 lines (75 loc) Β· 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# CLI main entry point (index.js)
cli_index = '''#!/usr/bin/env node
import { program } from 'commander';
import chalk from 'chalk';
import { initCommand } from './commands/init.js';
import { gitSyncCommand, gitUndoCommand } from './commands/git.js';
import { envCheckCommand, envGenCommand } from './commands/env.js';
import { portsCommand, cleanCommand } from './commands/system.js';
import { snippetAddCommand, snippetListCommand, snippetUseCommand } from './commands/snippet.js';
const logo = `
${chalk.cyan('ββββββββββββββββββββββββββββββββββββββ')}
${chalk.cyan('β')} ${chalk.bold('β‘ DevSuite CLI')} v1.0.0 ${chalk.cyan('β')}
${chalk.cyan('β')} ${chalk.dim("The Developer's Swiss Army Knife")} ${chalk.cyan('β')}
${chalk.cyan('ββββββββββββββββββββββββββββββββββββββ')}
`;
console.log(logo);
program
.name('devsuite')
.description('A powerful CLI toolkit for developers')
.version('1.0.0');
// Init command
program
.command('init <project-name>')
.description('Scaffold a new project with templates')
.option('-t, --template <type>', 'Project template (node, react, next, python, fastapi)', 'node')
.action(initCommand);
// Git commands
program
.command('git:sync')
.description('Pull, auto-resolve simple conflicts, and push')
.action(gitSyncCommand);
program
.command('git:undo')
.description('Safely undo the last commit (preserves changes)')
.option('--hard', 'Hard reset (discard changes)', false)
.action(gitUndoCommand);
// Environment commands
program
.command('env:check')
.description('Compare .env vs .env.example and show missing variables')
.action(envCheckCommand);
program
.command('env:gen')
.description('Auto-generate .env.example from .env (masks values)')
.action(envGenCommand);
// System commands
program
.command('ports')
.description('Show all ports in use with process names')
.action(portsCommand);
program
.command('clean')
.description('Remove node_modules, __pycache__, .DS_Store recursively')
.option('-d, --dry-run', 'Show what would be deleted without deleting', false)
.action(cleanCommand);
// Snippet commands
program
.command('snippet add <name>')
.description('Save a code snippet from clipboard')
.option('-l, --language <lang>', 'Programming language', 'text')
.action(snippetAddCommand);
program
.command('snippet list')
.description('List all saved snippets')
.option('-l, --language <lang>', 'Filter by language')
.action(snippetListCommand);
program
.command('snippet use <name>')
.description('Copy a saved snippet to clipboard')
.action(snippetUseCommand);
program.parse();
'''
with open(f"{base_path}/packages/cli/src/index.js", "w") as f:
f.write(cli_index)
print("β
CLI index.js created")