mcp-ssh-manager 3.0.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.
Files changed (56) hide show
  1. package/.claude/settings.local.json +87 -0
  2. package/.flake8 +15 -0
  3. package/.hooks-config.json +131 -0
  4. package/.pre-commit-config.yaml +105 -0
  5. package/CHANGELOG.md +137 -0
  6. package/CLAUDE.md +190 -0
  7. package/CONTRIBUTING.md +114 -0
  8. package/DESCRIPTION +1 -0
  9. package/INSTALLATION.md +180 -0
  10. package/LICENSE +21 -0
  11. package/QUICKSTART.md +77 -0
  12. package/README.md +718 -0
  13. package/cli/README.md +286 -0
  14. package/cli/build.sh +199 -0
  15. package/cli/commands/server.sh +284 -0
  16. package/cli/demo.sh +107 -0
  17. package/cli/install.sh +164 -0
  18. package/cli/lib/colors.sh +174 -0
  19. package/cli/lib/config.sh +284 -0
  20. package/cli/lib/menu.sh +430 -0
  21. package/cli/migrate.sh +168 -0
  22. package/cli/ssh-manager +525 -0
  23. package/docs/ALIASES_AND_HOOKS.md +285 -0
  24. package/docs/BACKUP_GUIDE.md +500 -0
  25. package/docs/DEPLOYMENT_GUIDE.md +241 -0
  26. package/docs/SEO.md +257 -0
  27. package/examples/backup-workflow.js +481 -0
  28. package/examples/claude-code-config.example.json +40 -0
  29. package/examples/codex-ssh-config.example.toml +71 -0
  30. package/examples/deploy-workflow.py +183 -0
  31. package/glama.json +6 -0
  32. package/package.json +85 -0
  33. package/profiles/README.md +40 -0
  34. package/profiles/default.json +52 -0
  35. package/profiles/docker.json +62 -0
  36. package/profiles/frappe.json +107 -0
  37. package/profiles/nodejs.json +63 -0
  38. package/pyproject.toml +17 -0
  39. package/scripts/setup-hooks.sh +60 -0
  40. package/scripts/validate.sh +76 -0
  41. package/src/backup-manager.js +469 -0
  42. package/src/command-aliases.js +151 -0
  43. package/src/config-loader.js +281 -0
  44. package/src/database-manager.js +555 -0
  45. package/src/deploy-helper.js +176 -0
  46. package/src/health-monitor.js +428 -0
  47. package/src/hooks-system.js +327 -0
  48. package/src/index.js +4499 -0
  49. package/src/logger.js +276 -0
  50. package/src/profile-loader.js +187 -0
  51. package/src/server-aliases.js +150 -0
  52. package/src/server-groups.js +409 -0
  53. package/src/session-manager.js +410 -0
  54. package/src/ssh-key-manager.js +378 -0
  55. package/src/ssh-manager.js +435 -0
  56. package/src/tunnel-manager.js +576 -0
@@ -0,0 +1,183 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Example deployment workflow using MCP SSH Manager
4
+ This script demonstrates how to automate deployments similar to the ERPNext scenario
5
+ """
6
+
7
+ import os
8
+ import sys
9
+ import json
10
+ from pathlib import Path
11
+
12
+ # Add parent directory to path to import tools
13
+ sys.path.insert(0, str(Path(__file__).parent.parent / 'tools'))
14
+
15
+ from server_manager import load_env_config, test_server_connection
16
+
17
+ def create_deployment_config(server_name, files, options=None):
18
+ """
19
+ Create a deployment configuration for ssh_deploy tool
20
+ """
21
+ config = {
22
+ "server": server_name,
23
+ "files": files,
24
+ "options": options or {}
25
+ }
26
+ return config
27
+
28
+ def deploy_erpnext_customization():
29
+ """
30
+ Example: Deploy ERPNext customization files
31
+ Similar to the user's scenario with payment_proposal files
32
+ """
33
+
34
+ # Define the files to deploy
35
+ files_to_deploy = [
36
+ {
37
+ "local": "/Users/jeremy/GitHub/erpnextswiss/erpnextswiss/doctype/payment_proposal/payment_proposal.py",
38
+ "remote": "/home/neoffice/frappe-bench/apps/erpnextswiss/erpnextswiss/doctype/payment_proposal/payment_proposal.py"
39
+ },
40
+ {
41
+ "local": "/Users/jeremy/GitHub/erpnextswiss/erpnextswiss/doctype/payment_proposal/payment_proposal.js",
42
+ "remote": "/home/neoffice/frappe-bench/apps/erpnextswiss/erpnextswiss/doctype/payment_proposal/payment_proposal.js"
43
+ }
44
+ ]
45
+
46
+ # Deployment options
47
+ options = {
48
+ "owner": "neoffice:neoffice", # Set correct ownership
49
+ "permissions": "644", # Standard file permissions
50
+ "backup": True, # Always backup before overwriting
51
+ "restart": "cd /home/neoffice/frappe-bench && bench restart" # Restart after deployment
52
+ }
53
+
54
+ # Create deployment configuration
55
+ deployment = create_deployment_config("dmis", files_to_deploy, options)
56
+
57
+ print("๐Ÿ“ฆ Deployment Configuration:")
58
+ print(json.dumps(deployment, indent=2))
59
+
60
+ # In Claude Code, you would say:
61
+ # "Deploy payment_proposal files to dmis server with neoffice ownership and restart bench"
62
+
63
+ return deployment
64
+
65
+ def deploy_web_application():
66
+ """
67
+ Example: Deploy web application files
68
+ """
69
+
70
+ files_to_deploy = [
71
+ {
72
+ "local": "./dist/index.html",
73
+ "remote": "/var/www/html/index.html"
74
+ },
75
+ {
76
+ "local": "./dist/app.js",
77
+ "remote": "/var/www/html/js/app.js"
78
+ },
79
+ {
80
+ "local": "./dist/styles.css",
81
+ "remote": "/var/www/html/css/styles.css"
82
+ }
83
+ ]
84
+
85
+ options = {
86
+ "owner": "www-data:www-data",
87
+ "permissions": "644",
88
+ "backup": True,
89
+ "restart": "systemctl restart nginx"
90
+ }
91
+
92
+ deployment = create_deployment_config("production", files_to_deploy, options)
93
+
94
+ print("๐ŸŒ Web Deployment Configuration:")
95
+ print(json.dumps(deployment, indent=2))
96
+
97
+ return deployment
98
+
99
+ def deploy_configuration_files():
100
+ """
101
+ Example: Deploy configuration files with elevated privileges
102
+ """
103
+
104
+ files_to_deploy = [
105
+ {
106
+ "local": "./config/nginx.conf",
107
+ "remote": "/etc/nginx/nginx.conf"
108
+ },
109
+ {
110
+ "local": "./config/app.env",
111
+ "remote": "/etc/myapp/app.env"
112
+ }
113
+ ]
114
+
115
+ options = {
116
+ "owner": "root:root",
117
+ "permissions": "600", # Restrictive permissions for config files
118
+ "backup": True,
119
+ "restart": "systemctl reload nginx && systemctl restart myapp"
120
+ }
121
+
122
+ deployment = create_deployment_config("production", files_to_deploy, options)
123
+
124
+ print("โš™๏ธ Configuration Deployment:")
125
+ print(json.dumps(deployment, indent=2))
126
+
127
+ return deployment
128
+
129
+ def main():
130
+ """
131
+ Demonstrate various deployment scenarios
132
+ """
133
+
134
+ print("๐Ÿš€ MCP SSH Manager - Deployment Examples")
135
+ print("=" * 50)
136
+ print()
137
+
138
+ # Check if server configuration exists
139
+ servers = load_env_config()
140
+
141
+ if not servers:
142
+ print("โš ๏ธ No servers configured. Run 'python tools/server_manager.py' to add servers.")
143
+ return
144
+
145
+ print("๐Ÿ“‹ Available servers:", ", ".join(servers.keys()))
146
+ print()
147
+
148
+ # Example 1: ERPNext deployment (like the user's scenario)
149
+ print("Example 1: ERPNext Deployment")
150
+ print("-" * 30)
151
+ deploy_erpnext_customization()
152
+ print()
153
+
154
+ # Example 2: Web application deployment
155
+ print("Example 2: Web Application Deployment")
156
+ print("-" * 30)
157
+ deploy_web_application()
158
+ print()
159
+
160
+ # Example 3: Configuration files deployment
161
+ print("Example 3: Configuration Files Deployment")
162
+ print("-" * 30)
163
+ deploy_configuration_files()
164
+ print()
165
+
166
+ print("๐Ÿ’ก Tips for using in Claude Code:")
167
+ print("-" * 30)
168
+ print("1. Create server aliases for easier access:")
169
+ print(' "Create alias dmis for dmis_server"')
170
+ print()
171
+ print("2. Deploy multiple files at once:")
172
+ print(' "Deploy all .py and .js files from payment_proposal to dmis"')
173
+ print()
174
+ print("3. Use sudo for system files:")
175
+ print(' "Deploy nginx.conf to production:/etc/nginx/ with sudo"')
176
+ print()
177
+ print("4. Always test connection first:")
178
+ print(' "Test connection to production server"')
179
+ print()
180
+ print("๐Ÿ“š See docs/DEPLOYMENT_GUIDE.md for complete documentation")
181
+
182
+ if __name__ == "__main__":
183
+ main()
package/glama.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://glama.ai/mcp/schemas/server.json",
3
+ "maintainers": [
4
+ "bvisible"
5
+ ]
6
+ }
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "mcp-ssh-manager",
3
+ "version": "3.0.0",
4
+ "description": "MCP SSH Manager: Model Context Protocol server for SSH remote server management. Control SSH connections from Claude Code and OpenAI Codex - execute commands, transfer files, database operations, backups, health monitoring, and DevOps automation",
5
+ "main": "src/index.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "start": "node src/index.js",
9
+ "setup": "npm install && pip install -r tools/requirements.txt",
10
+ "configure": "python tools/server-manager.py",
11
+ "test-connection": "python tools/test-connection.py",
12
+ "test": "npm run test:profiles && npm run test:aliases && npm run test:hooks",
13
+ "test:profiles": "node tests/test-profiles.js",
14
+ "test:aliases": "node tests/test-command-aliases.js",
15
+ "test:hooks": "node tests/test-hooks.js",
16
+ "test:all": "npm test && ./scripts/validate.sh",
17
+ "validate": "./scripts/validate.sh",
18
+ "lint": "eslint src/*.js",
19
+ "format": "prettier --write 'src/**/*.js' 'tests/**/*.js'"
20
+ },
21
+ "keywords": [
22
+ "mcp",
23
+ "ssh",
24
+ "mcp-ssh",
25
+ "mcp ssh",
26
+ "ssh-mcp",
27
+ "ssh mcp",
28
+ "model-context-protocol-ssh",
29
+ "mcp-server",
30
+ "mcp server ssh",
31
+ "claude-code",
32
+ "claude-ssh",
33
+ "claude-code-ssh",
34
+ "openai-codex",
35
+ "codex",
36
+ "model-context-protocol",
37
+ "remote-server",
38
+ "ssh-manager",
39
+ "ssh manager mcp",
40
+ "remote-ssh",
41
+ "ssh-automation",
42
+ "deployment",
43
+ "devops",
44
+ "automation",
45
+ "backup",
46
+ "restore",
47
+ "health-monitoring",
48
+ "database",
49
+ "mysql",
50
+ "postgresql",
51
+ "mongodb",
52
+ "profiles",
53
+ "hooks",
54
+ "aliases",
55
+ "toml",
56
+ "ai-assistant",
57
+ "ai-tools",
58
+ "llm-tools"
59
+ ],
60
+ "author": "MCP SSH Manager Contributors",
61
+ "license": "MIT",
62
+ "repository": {
63
+ "type": "git",
64
+ "url": "https://github.com/bvisible/mcp-ssh-manager.git"
65
+ },
66
+ "bugs": {
67
+ "url": "https://github.com/bvisible/mcp-ssh-manager/issues"
68
+ },
69
+ "homepage": "https://github.com/bvisible/mcp-ssh-manager#readme",
70
+ "dependencies": {
71
+ "@iarna/toml": "^2.2.5",
72
+ "@modelcontextprotocol/sdk": "^1.17.2",
73
+ "dotenv": "^16.4.5",
74
+ "ssh2": "^1.17.0",
75
+ "uuid": "^11.1.0",
76
+ "zod": "^3.25.76"
77
+ },
78
+ "devDependencies": {
79
+ "eslint": "^8.56.0",
80
+ "prettier": "^3.2.4"
81
+ },
82
+ "engines": {
83
+ "node": ">=18.0.0"
84
+ }
85
+ }
@@ -0,0 +1,40 @@
1
+ # SSH Manager Profiles
2
+
3
+ Profiles allow you to configure command aliases and hooks for specific project types.
4
+
5
+ ## Available Profiles
6
+
7
+ - `default.json` - Basic SSH operations (minimal setup)
8
+ - `frappe.json` - Frappe/ERPNext specific commands and hooks
9
+ - `docker.json` - Docker container management
10
+ - `kubernetes.json` - Kubernetes cluster operations
11
+ - `nodejs.json` - Node.js application deployment
12
+ - `python.json` - Python application deployment
13
+
14
+ ## Creating Custom Profiles
15
+
16
+ Create a JSON file in this directory with your custom configuration:
17
+
18
+ ```json
19
+ {
20
+ "name": "my-project",
21
+ "description": "Custom profile for my project",
22
+ "commandAliases": {
23
+ "deploy": "git pull && npm install && npm run build",
24
+ "restart": "pm2 restart all"
25
+ },
26
+ "hooks": {
27
+ "pre-deploy": {
28
+ "enabled": true,
29
+ "actions": [...]
30
+ }
31
+ }
32
+ }
33
+ ```
34
+
35
+ ## Loading Profiles
36
+
37
+ Profiles can be loaded via:
38
+ 1. Environment variable: `SSH_MANAGER_PROFILE=frappe`
39
+ 2. Configuration file: `.ssh-manager-profile` in project root
40
+ 3. Default: Uses `default.json` if no profile specified
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "default",
3
+ "description": "Default profile with basic SSH operations",
4
+ "commandAliases": {
5
+ "check-memory": "free -h",
6
+ "check-disk": "df -h",
7
+ "check-processes": "ps aux | head -20",
8
+ "check-ports": "netstat -tlnp 2>/dev/null || ss -tlnp",
9
+ "system-info": "uname -a && lsb_release -a 2>/dev/null || cat /etc/os-release",
10
+ "tail-logs": "tail -f -n 100",
11
+ "disk-usage": "du -sh * | sort -rh | head -20",
12
+ "find-large-files": "find . -type f -size +100M -exec ls -lh {} \\;",
13
+ "backup-folder": "tar -czf backup-$(date +%Y%m%d-%H%M%S).tar.gz"
14
+ },
15
+ "hooks": {
16
+ "pre-deploy": {
17
+ "enabled": false,
18
+ "description": "Run before any deployment",
19
+ "actions": [
20
+ {
21
+ "type": "validation",
22
+ "name": "check-disk-space",
23
+ "remoteCommand": "df -h | grep -E \"/$\" | awk '{print $5}' | sed 's/%//' | awk '{if($1 > 90) exit 1}'",
24
+ "server": "{server}",
25
+ "errorMessage": "Insufficient disk space (>90% used)"
26
+ }
27
+ ]
28
+ },
29
+ "post-deploy": {
30
+ "enabled": false,
31
+ "description": "Run after successful deployment",
32
+ "actions": [
33
+ {
34
+ "type": "notification",
35
+ "name": "log-deployment",
36
+ "command": "echo \"[$(date)] Deployment completed to {server}\" >> deployments.log"
37
+ }
38
+ ]
39
+ },
40
+ "on-error": {
41
+ "enabled": true,
42
+ "description": "Run when an error occurs",
43
+ "actions": [
44
+ {
45
+ "type": "notification",
46
+ "name": "log-error",
47
+ "command": "echo \"[$(date)] Error on {server}: {error}\" >> errors.log"
48
+ }
49
+ ]
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "docker",
3
+ "description": "Docker container management profile",
4
+ "commandAliases": {
5
+ "docker-ps": "docker ps -a",
6
+ "docker-logs": "docker-compose logs -f --tail=100",
7
+ "docker-restart": "docker-compose restart",
8
+ "docker-up": "docker-compose up -d",
9
+ "docker-down": "docker-compose down",
10
+ "docker-build": "docker-compose build --no-cache",
11
+ "docker-pull": "docker-compose pull",
12
+ "docker-exec": "docker-compose exec",
13
+ "docker-clean": "docker system prune -af",
14
+ "docker-stats": "docker stats --no-stream",
15
+ "docker-volumes": "docker volume ls",
16
+ "docker-networks": "docker network ls",
17
+ "docker-images": "docker images",
18
+ "check-containers": "docker ps --format 'table {{.Names}}\\t{{.Status}}\\t{{.Ports}}'",
19
+ "container-health": "docker ps --filter health=unhealthy"
20
+ },
21
+ "hooks": {
22
+ "pre-deploy": {
23
+ "enabled": true,
24
+ "description": "Run before Docker deployment",
25
+ "actions": [
26
+ {
27
+ "type": "validation",
28
+ "name": "check-docker",
29
+ "remoteCommand": "docker version > /dev/null 2>&1",
30
+ "server": "{server}",
31
+ "errorMessage": "Docker is not running or not installed"
32
+ },
33
+ {
34
+ "type": "backup",
35
+ "name": "backup-volumes",
36
+ "remoteCommand": "docker run --rm -v $(pwd):/backup alpine tar czf /backup/volumes-backup-$(date +%Y%m%d).tar.gz /var/lib/docker/volumes",
37
+ "server": "{server}",
38
+ "optional": true
39
+ }
40
+ ]
41
+ },
42
+ "post-deploy": {
43
+ "enabled": true,
44
+ "description": "Run after Docker deployment",
45
+ "actions": [
46
+ {
47
+ "type": "verification",
48
+ "name": "check-containers",
49
+ "remoteCommand": "docker-compose ps",
50
+ "server": "{server}"
51
+ },
52
+ {
53
+ "type": "notification",
54
+ "name": "restart-containers",
55
+ "remoteCommand": "docker-compose restart",
56
+ "server": "{server}",
57
+ "optional": true
58
+ }
59
+ ]
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,107 @@
1
+ {
2
+ "name": "frappe",
3
+ "description": "Frappe/ERPNext framework profile",
4
+ "commandAliases": {
5
+ "bench-update": "bench update --pull --patch --build --requirements",
6
+ "bench-update-fast": "bench update --pull",
7
+ "bench-restart": "bench restart",
8
+ "bench-start": "bench start",
9
+ "bench-stop": "bench stop",
10
+ "bench-logs": "bench --site all logs",
11
+ "bench-console": "bench console",
12
+ "bench-mariadb": "bench mariadb",
13
+ "bench-migrate": "bench --site all migrate",
14
+ "bench-clear-cache": "bench --site all clear-cache",
15
+ "bench-rebuild": "bench build --force",
16
+ "bench-backup": "bench --site all backup --with-files",
17
+ "bench-restore": "bench --site all restore",
18
+ "bench-enable-scheduler": "bench --site all enable-scheduler",
19
+ "bench-disable-scheduler": "bench --site all disable-scheduler",
20
+ "bench-doctor": "bench doctor",
21
+ "bench-watch": "bench watch",
22
+ "bench-git-status": "bench update --pull --no-backup --no-compile --dry-run",
23
+ "bench-git-pull": "cd apps/frappe && git pull && cd ../erpnext && git pull",
24
+ "frappe-version": "bench version",
25
+ "check-supervisor": "sudo supervisorctl status",
26
+ "restart-supervisor": "sudo supervisorctl restart all",
27
+ "check-redis": "redis-cli ping",
28
+ "check-mysql": "mysqladmin ping",
29
+ "check-nginx": "nginx -t"
30
+ },
31
+ "hooks": {
32
+ "pre-bench-update": {
33
+ "enabled": true,
34
+ "description": "Run before bench update",
35
+ "actions": [
36
+ {
37
+ "type": "backup",
38
+ "name": "backup-database",
39
+ "remoteCommand": "bench --site all backup --with-files",
40
+ "server": "{server}"
41
+ },
42
+ {
43
+ "type": "validation",
44
+ "name": "check-disk-space",
45
+ "remoteCommand": "df -h | grep -E \"/$|/home\" | awk '{print $5}' | sed 's/%//' | awk '{if($1 > 80) exit 1}'",
46
+ "server": "{server}",
47
+ "errorMessage": "Insufficient disk space (>80% used)"
48
+ }
49
+ ]
50
+ },
51
+ "post-bench-update": {
52
+ "enabled": true,
53
+ "description": "Run after bench update",
54
+ "actions": [
55
+ {
56
+ "type": "verification",
57
+ "name": "check-services",
58
+ "remoteCommand": "supervisorctl status | grep -E \"RUNNING|STOPPED\"",
59
+ "server": "{server}"
60
+ },
61
+ {
62
+ "type": "verification",
63
+ "name": "check-site-status",
64
+ "remoteCommand": "bench --site all doctor",
65
+ "server": "{server}"
66
+ },
67
+ {
68
+ "type": "notification",
69
+ "name": "clear-cache",
70
+ "remoteCommand": "bench --site all clear-cache",
71
+ "server": "{server}"
72
+ }
73
+ ]
74
+ },
75
+ "pre-deploy": {
76
+ "enabled": true,
77
+ "description": "Run before Frappe app deployment",
78
+ "actions": [
79
+ {
80
+ "type": "validation",
81
+ "name": "check-bench-status",
82
+ "remoteCommand": "bench doctor",
83
+ "server": "{server}",
84
+ "optional": true
85
+ }
86
+ ]
87
+ },
88
+ "post-deploy": {
89
+ "enabled": true,
90
+ "description": "Run after Frappe app deployment",
91
+ "actions": [
92
+ {
93
+ "type": "notification",
94
+ "name": "restart-workers",
95
+ "remoteCommand": "bench restart",
96
+ "server": "{server}"
97
+ },
98
+ {
99
+ "type": "notification",
100
+ "name": "clear-cache",
101
+ "remoteCommand": "bench --site all clear-cache",
102
+ "server": "{server}"
103
+ }
104
+ ]
105
+ }
106
+ }
107
+ }
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "nodejs",
3
+ "description": "Node.js application deployment profile",
4
+ "commandAliases": {
5
+ "npm-install": "npm ci --production",
6
+ "npm-update": "npm update",
7
+ "npm-build": "npm run build",
8
+ "npm-start": "npm start",
9
+ "npm-test": "npm test",
10
+ "npm-logs": "npm run logs",
11
+ "pm2-list": "pm2 list",
12
+ "pm2-restart": "pm2 restart all",
13
+ "pm2-reload": "pm2 reload all",
14
+ "pm2-stop": "pm2 stop all",
15
+ "pm2-logs": "pm2 logs --lines 100",
16
+ "pm2-monit": "pm2 monit",
17
+ "pm2-status": "pm2 status",
18
+ "node-version": "node --version && npm --version",
19
+ "check-deps": "npm outdated",
20
+ "audit-fix": "npm audit fix",
21
+ "clear-cache": "npm cache clean --force"
22
+ },
23
+ "hooks": {
24
+ "pre-deploy": {
25
+ "enabled": true,
26
+ "description": "Run before Node.js deployment",
27
+ "actions": [
28
+ {
29
+ "type": "validation",
30
+ "name": "check-node",
31
+ "remoteCommand": "node --version",
32
+ "server": "{server}",
33
+ "errorMessage": "Node.js is not installed"
34
+ },
35
+ {
36
+ "type": "validation",
37
+ "name": "test-app",
38
+ "remoteCommand": "npm test",
39
+ "server": "{server}",
40
+ "optional": true
41
+ }
42
+ ]
43
+ },
44
+ "post-deploy": {
45
+ "enabled": true,
46
+ "description": "Run after Node.js deployment",
47
+ "actions": [
48
+ {
49
+ "type": "notification",
50
+ "name": "install-deps",
51
+ "remoteCommand": "npm ci --production",
52
+ "server": "{server}"
53
+ },
54
+ {
55
+ "type": "notification",
56
+ "name": "restart-app",
57
+ "remoteCommand": "pm2 restart all || npm restart",
58
+ "server": "{server}"
59
+ }
60
+ ]
61
+ }
62
+ }
63
+ }
package/pyproject.toml ADDED
@@ -0,0 +1,17 @@
1
+ [tool.black]
2
+ line-length = 100
3
+ target-version = ['py38']
4
+ include = '\.pyi?$'
5
+ exclude = '''
6
+ /(
7
+ \.git
8
+ | \.venv
9
+ | venv
10
+ | node_modules
11
+ | __pycache__
12
+ )/
13
+ '''
14
+
15
+ [tool.isort]
16
+ profile = "black"
17
+ line_length = 100
@@ -0,0 +1,60 @@
1
+ #!/bin/bash
2
+
3
+ echo "๐Ÿ”ง Setting up Git hooks for code quality..."
4
+ echo "=========================================="
5
+ echo ""
6
+
7
+ # Check if Python is installed
8
+ if ! command -v python3 &> /dev/null; then
9
+ echo "โŒ Python 3 is required but not installed."
10
+ exit 1
11
+ fi
12
+
13
+ # Check if Node.js is installed
14
+ if ! command -v node &> /dev/null; then
15
+ echo "โŒ Node.js is required but not installed."
16
+ exit 1
17
+ fi
18
+
19
+ # Install pre-commit
20
+ echo "๐Ÿ“ฆ Installing pre-commit..."
21
+ pip install pre-commit
22
+
23
+ # Install Node.js dev dependencies
24
+ echo "๐Ÿ“ฆ Installing Node.js linting tools..."
25
+ npm install --save-dev eslint prettier
26
+
27
+ # Install Python linting tools
28
+ echo "๐Ÿ“ฆ Installing Python linting tools..."
29
+ pip install black flake8 isort
30
+
31
+ # Install pre-commit hooks
32
+ echo "๐Ÿ”— Installing git hooks..."
33
+ pre-commit install
34
+
35
+ # Create secrets baseline
36
+ echo "๐Ÿ” Creating secrets baseline..."
37
+ pip install detect-secrets
38
+ detect-secrets scan > .secrets.baseline
39
+
40
+ # Run hooks on all files (optional first run)
41
+ echo ""
42
+ echo "๐Ÿงช Testing hooks on existing files..."
43
+ pre-commit run --all-files || true
44
+
45
+ echo ""
46
+ echo "โœ… Git hooks setup complete!"
47
+ echo ""
48
+ echo "The following checks will run before each commit:"
49
+ echo " โœ“ JavaScript syntax checking"
50
+ echo " โœ“ Python syntax checking"
51
+ echo " โœ“ ESLint (JavaScript linting)"
52
+ echo " โœ“ Black (Python formatting)"
53
+ echo " โœ“ Flake8 (Python linting)"
54
+ echo " โœ“ Prettier (code formatting)"
55
+ echo " โœ“ Secret detection"
56
+ echo " โœ“ Trailing whitespace removal"
57
+ echo " โœ“ Large file prevention"
58
+ echo ""
59
+ echo "To skip hooks temporarily: git commit --no-verify"
60
+ echo "To run hooks manually: pre-commit run --all-files"