grit-cgn 1.3.2 → 1.3.3
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/index.js +15 -42
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,66 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { Command } = require('commander');
|
|
4
|
-
const
|
|
5
|
-
const fs = require('fs-extra');
|
|
6
|
-
const path = require('path');
|
|
7
|
-
const { GoogleGenAI, Type } = require('@google/genai');
|
|
8
|
-
|
|
9
|
-
// Importando as novas funções de rede
|
|
4
|
+
const { initializeModule } = require('./src/commands/init');
|
|
10
5
|
const { startTunnel } = require('./src/commands/tunnel');
|
|
11
|
-
const {
|
|
6
|
+
const { startMesh } = require('./src/commands/mesh');
|
|
12
7
|
|
|
13
8
|
const program = new Command();
|
|
14
|
-
const ai = new GoogleGenAI({});
|
|
15
9
|
|
|
16
10
|
program
|
|
17
|
-
.
|
|
18
|
-
.description('Grit CLI - AI-Powered Infrastructure & Network Orchestrator')
|
|
11
|
+
.name('grit')
|
|
12
|
+
.description('Grit CLI - AI-Powered Infrastructure & Network Orchestrator')
|
|
13
|
+
.version('1.3.3');
|
|
19
14
|
|
|
20
|
-
// --- COMANDO EXISTENTE: INIT ---
|
|
21
15
|
program
|
|
22
|
-
.command('init
|
|
23
|
-
.
|
|
24
|
-
.
|
|
25
|
-
.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
.option('-husk', 'Enable Husk network shield')
|
|
29
|
-
.action(async (module, options) => {
|
|
30
|
-
if (module === 'server') {
|
|
31
|
-
await startServerCommand();
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
// (A lógica interna massiva de criação da blockchain que já construímos continua exatamente aqui...)
|
|
35
|
-
console.log("Para iniciar o nó blockchain utilize a pasta do projeto.");
|
|
16
|
+
.command('init')
|
|
17
|
+
.description('Initialize a new infrastructure module or blockchain node')
|
|
18
|
+
.argument('<module>', 'Name of the module to initialize (e.g., termchain)')
|
|
19
|
+
.action((moduleName) => {
|
|
20
|
+
// A validação foi movida/suavizada para dentro do comando correspondente
|
|
21
|
+
initializeModule(moduleName);
|
|
36
22
|
});
|
|
37
23
|
|
|
38
|
-
// --- NOVO COMANDO 2: TUNNEL ---
|
|
39
24
|
program
|
|
40
|
-
.command('tunnel
|
|
41
|
-
.description('Expose a local port
|
|
25
|
+
.command('tunnel')
|
|
26
|
+
.description('Expose a local port through a secure public URL gateway')
|
|
27
|
+
.argument('<port>', 'Local port to tunnel')
|
|
42
28
|
.action((port) => {
|
|
43
29
|
startTunnel(port);
|
|
44
30
|
});
|
|
45
31
|
|
|
46
|
-
// --- NOVO COMANDO 3: MESH VPN ---
|
|
47
32
|
program
|
|
48
33
|
.command('mesh')
|
|
49
34
|
.description('Orchestrate or join a decentralized peer-to-peer mesh VPN tunnel')
|
|
50
35
|
.action(() => {
|
|
51
|
-
|
|
36
|
+
startMesh();
|
|
52
37
|
});
|
|
53
38
|
|
|
54
|
-
async function startServerCommand() {
|
|
55
|
-
const manifestPath = path.join(process.cwd(), '.grit', 'manifest.json');
|
|
56
|
-
if (!await fs.pathExists(manifestPath)) {
|
|
57
|
-
console.log("[Grit Error] No active Grit environment signature found in this directory.");
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const manifest = await fs.readJson(manifestPath);
|
|
61
|
-
console.log(`\n🔥 Grit Engine Online [AI Generated Heavy-Duty Core]`);
|
|
62
|
-
const userIndex = path.join(process.cwd(), 'index.js');
|
|
63
|
-
if (await fs.pathExists(userIndex)) { require(userIndex); }
|
|
64
|
-
}
|
|
65
|
-
|
|
66
39
|
program.parse(process.argv);
|