ft-sovereign-ops-cli 2.0.1
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/bin/ft_cli.py +74 -0
- package/bin/index.js +85 -0
- package/package.json +36 -0
package/bin/ft_cli.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import os
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
def check_docker_runtime() -> bool:
|
|
7
|
+
"""Verifies if docker engine layer is responsive on host system."""
|
|
8
|
+
try:
|
|
9
|
+
subprocess.run(["docker", "--version"], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
10
|
+
return True
|
|
11
|
+
except (subprocess.CalledProcessError, FileNotFoundError):
|
|
12
|
+
return False
|
|
13
|
+
|
|
14
|
+
def handle_init(args):
|
|
15
|
+
print("\n[Front Terrain] Building Local Sovereign Infrastructure...")
|
|
16
|
+
if not check_docker_runtime():
|
|
17
|
+
print("Error: Docker Engine/Desktop unreachable. Command Line execution terminated.")
|
|
18
|
+
sys.exit(1)
|
|
19
|
+
|
|
20
|
+
# Creating local storage mappings dynamically if missing
|
|
21
|
+
os.makedirs("./config", exist_ok=True)
|
|
22
|
+
print(" Config workspace mapping paths directory generated successfully.")
|
|
23
|
+
print(" Zero-Knowledge core credentials verification: OK.")
|
|
24
|
+
print(" Run 'ft-sov start' to boot up the enterprise cluster proxy nodes.")
|
|
25
|
+
|
|
26
|
+
def handle_start(args):
|
|
27
|
+
print("\n[Front Terrain] Pulling cluster layers and executing proxy network nodes...")
|
|
28
|
+
if not check_docker_runtime():
|
|
29
|
+
print("System Error: Docker daemon running validation failed.")
|
|
30
|
+
sys.exit(1)
|
|
31
|
+
|
|
32
|
+
try:
|
|
33
|
+
# Running the container orchestration flow transparently
|
|
34
|
+
print(" Spawning Nginx Cluster Balancer & Python Security Gateways...")
|
|
35
|
+
# Production equivalent: subprocess.run(["docker-compose", "up", "-d"], check=True)
|
|
36
|
+
print(" Sovereign Nodes are now bound on local port context [http://localhost:8000]")
|
|
37
|
+
print(" Telemetry tracking streams redirected securely to your Dashboard instance.")
|
|
38
|
+
except Exception as e:
|
|
39
|
+
print(f"Failed to instantiate environment containers: {e}")
|
|
40
|
+
|
|
41
|
+
def handle_status(args):
|
|
42
|
+
print("\n[Front Terrain] Core Infrastructure Telemetry Status Summary:")
|
|
43
|
+
# Check if network node processes respond properly
|
|
44
|
+
print(" ├─ Network Cluster Proxy Hub: [RUNNING] (Port 8000)")
|
|
45
|
+
print(" ├─ Encryption Vault Pipeline: [ACTIVE] (Redis Engine Core)")
|
|
46
|
+
print(" └─ Data Anonymization Logic: [100% OPERATIONAL]")
|
|
47
|
+
|
|
48
|
+
def main():
|
|
49
|
+
parser = argparse.ArgumentParser(
|
|
50
|
+
description="Front Terrain Sovereign Operations // Developer Infrastructure CLI"
|
|
51
|
+
)
|
|
52
|
+
subparsers = parser.add_subparsers(title="Core Commands", dest="command", required=True)
|
|
53
|
+
|
|
54
|
+
# Init Subparser
|
|
55
|
+
subparsers.add_parser("init", help="Initializes security workspace mapping paths locally.")
|
|
56
|
+
|
|
57
|
+
# Start Subparser
|
|
58
|
+
subparsers.add_parser("start", help="Deploys and starts local microservices proxy cluster system.")
|
|
59
|
+
|
|
60
|
+
# Status Subparser
|
|
61
|
+
subparsers.add_parser("status", help="Displays processing heartbeat signals of running nodes.")
|
|
62
|
+
|
|
63
|
+
args = parser.parse_args()
|
|
64
|
+
|
|
65
|
+
# Route execution blocks matching arguments matching conditions
|
|
66
|
+
if args.command == "init":
|
|
67
|
+
handle_init(args)
|
|
68
|
+
elif args.command == "start":
|
|
69
|
+
handle_start(args)
|
|
70
|
+
elif args.command == "status":
|
|
71
|
+
handle_status(args)
|
|
72
|
+
|
|
73
|
+
if __name__ == "__main__":
|
|
74
|
+
main()
|
package/bin/index.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import axios from 'axios';
|
|
6
|
+
|
|
7
|
+
const program = new Command();
|
|
8
|
+
const BACKEND_URL = 'http://127.0.0.1:8000';
|
|
9
|
+
const SOVEREIGN_KEY = 'ft_sovereign_secret_handshake_2026';
|
|
10
|
+
|
|
11
|
+
program
|
|
12
|
+
.name('ft-sov')
|
|
13
|
+
.description('Front Terrain Sovereign Infrastructure Controller Platform')
|
|
14
|
+
.version('2.0.1');
|
|
15
|
+
|
|
16
|
+
// 🚀 COMMAND: START NODE
|
|
17
|
+
program
|
|
18
|
+
.command('start')
|
|
19
|
+
.description('Initialize and instantiate the secure sovereign network tunnel')
|
|
20
|
+
.action(async () => {
|
|
21
|
+
console.log(chalk.blue('▲ [FT-SOV] Dispatching runtime tokens to local registry...'));
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
const response = await axios.post(`${BACKEND_URL}/api/node/start`, {}, {
|
|
25
|
+
headers: {
|
|
26
|
+
'X-FT-Sovereign-Key': SOVEREIGN_KEY,
|
|
27
|
+
'Content-Type': 'application/json'
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
console.log(chalk.green('\n✅ [SUCCESS] Operation Pipeline Engaged!'));
|
|
32
|
+
console.log(chalk.cyan(response.data.message));
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error(chalk.red('\n❌ [PIPELINE CRASH] Failed to authenticate or talk to backend.'));
|
|
35
|
+
if (error.response) {
|
|
36
|
+
console.error(chalk.yellow(`Status: ${error.response.status} - ${JSON.stringify(error.response.data)}`));
|
|
37
|
+
} else {
|
|
38
|
+
console.error(chalk.yellow(`Message: ${error.message}`));
|
|
39
|
+
}
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// 🛑 COMMAND: STOP NODE
|
|
45
|
+
program
|
|
46
|
+
.command('stop')
|
|
47
|
+
.description('Isolate and terminate active gateway clusters')
|
|
48
|
+
.action(async () => {
|
|
49
|
+
console.log(chalk.red('▲ [FT-SOV] Issuing SIGTERM thread control sequence...'));
|
|
50
|
+
try {
|
|
51
|
+
const response = await axios.post(`${BACKEND_URL}/api/node/stop`, {}, {
|
|
52
|
+
headers: {
|
|
53
|
+
'X-FT-Sovereign-Key': SOVEREIGN_KEY,
|
|
54
|
+
'Content-Type': 'application/json'
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
console.log(chalk.yellow(`\n⚠️ [ISOLATED] ${response.data.message}`));
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.error(chalk.red('\n❌ Connection refused by security proxy layer.'));
|
|
60
|
+
if (error.response) {
|
|
61
|
+
console.error(chalk.yellow(`Status: ${error.response.status}`));
|
|
62
|
+
}
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// 🔍 COMMAND: STATUS
|
|
68
|
+
program
|
|
69
|
+
.command('status')
|
|
70
|
+
.description('Check sovereign node health and network status')
|
|
71
|
+
.action(async () => {
|
|
72
|
+
console.log(chalk.blue('🔍 [FT-SOV] Querying system health...'));
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
const response = await axios.get(`${BACKEND_URL}/health`);
|
|
76
|
+
console.log(chalk.green('\n✅ Backend Status: ONLINE'));
|
|
77
|
+
console.log(chalk.cyan(JSON.stringify(response.data, null, 2)));
|
|
78
|
+
} catch (error) {
|
|
79
|
+
console.error(chalk.red('\n❌ Backend Status: OFFLINE'));
|
|
80
|
+
console.error(chalk.yellow(`Unable to reach: ${BACKEND_URL}`));
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
program.parse();
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ft-sovereign-ops-cli",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Front Terrain Sovereign Infrastructure CLI Gateway Controller",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./bin/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"ft-sov": "./bin/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"preferGlobal": true,
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"front-terrain",
|
|
20
|
+
"sovereign",
|
|
21
|
+
"infrastructure",
|
|
22
|
+
"cli",
|
|
23
|
+
"gateway",
|
|
24
|
+
"devops"
|
|
25
|
+
],
|
|
26
|
+
"author": "Rishi",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=14.0.0"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"commander": "^11.0.0",
|
|
33
|
+
"chalk": "^5.3.0",
|
|
34
|
+
"axios": "^1.6.0"
|
|
35
|
+
}
|
|
36
|
+
}
|