@constellation-network/node-pilot 0.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/README.md +213 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +19 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +15 -0
- package/dist/checks/check-hardware.d.ts +3 -0
- package/dist/checks/check-hardware.js +50 -0
- package/dist/checks/check-initial-setup.d.ts +3 -0
- package/dist/checks/check-initial-setup.js +15 -0
- package/dist/checks/check-layers.d.ts +7 -0
- package/dist/checks/check-layers.js +87 -0
- package/dist/checks/check-network.d.ts +6 -0
- package/dist/checks/check-network.js +72 -0
- package/dist/checks/check-project.d.ts +6 -0
- package/dist/checks/check-project.js +108 -0
- package/dist/clm.d.ts +9 -0
- package/dist/clm.js +30 -0
- package/dist/commands/config/get.d.ts +9 -0
- package/dist/commands/config/get.js +37 -0
- package/dist/commands/config/set.d.ts +11 -0
- package/dist/commands/config/set.js +41 -0
- package/dist/commands/config.d.ts +6 -0
- package/dist/commands/config.js +65 -0
- package/dist/commands/info.d.ts +6 -0
- package/dist/commands/info.js +32 -0
- package/dist/commands/logs.d.ts +12 -0
- package/dist/commands/logs.js +28 -0
- package/dist/commands/restart.d.ts +6 -0
- package/dist/commands/restart.js +25 -0
- package/dist/commands/shutdown.d.ts +6 -0
- package/dist/commands/shutdown.js +18 -0
- package/dist/commands/status.d.ts +6 -0
- package/dist/commands/status.js +22 -0
- package/dist/commands/test.d.ts +6 -0
- package/dist/commands/test.js +13 -0
- package/dist/config-store.d.ts +109 -0
- package/dist/config-store.js +151 -0
- package/dist/helpers/config-helper.d.ts +14 -0
- package/dist/helpers/config-helper.js +39 -0
- package/dist/helpers/docker-helper.d.ts +7 -0
- package/dist/helpers/docker-helper.js +37 -0
- package/dist/helpers/env-templates.d.ts +4 -0
- package/dist/helpers/env-templates.js +33 -0
- package/dist/helpers/github-helper.d.ts +3 -0
- package/dist/helpers/github-helper.js +13 -0
- package/dist/helpers/key-file-helper.d.ts +9 -0
- package/dist/helpers/key-file-helper.js +136 -0
- package/dist/helpers/project-helper.d.ts +9 -0
- package/dist/helpers/project-helper.js +85 -0
- package/dist/helpers/prompt-helper.d.ts +8 -0
- package/dist/helpers/prompt-helper.js +135 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/info/cluster-info.d.ts +1 -0
- package/dist/info/cluster-info.js +16 -0
- package/dist/services/cluster-service.d.ts +9 -0
- package/dist/services/cluster-service.js +67 -0
- package/dist/services/fastforward-service.d.ts +14 -0
- package/dist/services/fastforward-service.js +84 -0
- package/dist/services/node-service.d.ts +10 -0
- package/dist/services/node-service.js +117 -0
- package/dist/services/shell-service.d.ts +9 -0
- package/dist/services/shell-service.js +53 -0
- package/dist/styles.d.ts +4 -0
- package/dist/styles.js +5 -0
- package/dist/types.d.ts +22 -0
- package/dist/types.js +1 -0
- package/oclif.manifest.json +241 -0
- package/package.json +98 -0
- package/projects/hypergraph/Dockerfile +41 -0
- package/projects/hypergraph/docker-compose.yml +54 -0
- package/projects/hypergraph/entrypoint.sh +35 -0
- package/projects/hypergraph/layers/gl1.env +3 -0
- package/projects/hypergraph/networks/integrationnet.env +9 -0
- package/projects/hypergraph/networks/mainnet.env +8 -0
- package/projects/hypergraph/networks/testnet.env +9 -0
- package/projects/hypergraph/pilot.env +2 -0
- package/projects/hypergraph/scripts/docker-build.sh +7 -0
- package/projects/hypergraph/scripts/install-dependencies.sh +318 -0
- package/projects/hypergraph/scripts/install.sh +149 -0
- package/projects/scripts/docker-cleanup.sh +64 -0
@@ -0,0 +1,84 @@
|
|
1
|
+
import { serializeBrotli } from "@stardust-collective/dag4-keystore";
|
2
|
+
import chalk from "chalk";
|
3
|
+
import fs from "node:fs";
|
4
|
+
import 'json-bigint-patch';
|
5
|
+
import path from "node:path";
|
6
|
+
import { clm } from "../clm.js";
|
7
|
+
import { configStore } from "../config-store.js";
|
8
|
+
const CHUNK_SIZE = 20_000;
|
9
|
+
export class FastforwardService {
|
10
|
+
dataDir;
|
11
|
+
lbUrl;
|
12
|
+
network;
|
13
|
+
tmpDir;
|
14
|
+
constructor() {
|
15
|
+
const { projectDir } = configStore.getProjectInfo();
|
16
|
+
const { type } = configStore.getNetworkInfo();
|
17
|
+
this.network = type;
|
18
|
+
this.tmpDir = path.join(projectDir, 'app-data', 'tmp');
|
19
|
+
this.dataDir = path.join(projectDir, 'app-data', 'gl0-data'); // gl0
|
20
|
+
fs.mkdirSync(this.tmpDir, { recursive: true });
|
21
|
+
fs.mkdirSync(this.dataDir, { recursive: true });
|
22
|
+
const env = configStore.getEnvCommonInfo();
|
23
|
+
// this.lbUrl = `https://l0-lb-${this.network}.constellationnetwork.io`;
|
24
|
+
this.lbUrl = `http://${env.CL_GLOBAL_L0_PEER_HOST}:${env.CL_GLOBAL_L0_PEER_HTTP_PORT}`;
|
25
|
+
}
|
26
|
+
static async synctoLatestSnapshot() {
|
27
|
+
const ffs = new FastforwardService();
|
28
|
+
await ffs.runFastForwardSnapshot();
|
29
|
+
}
|
30
|
+
async runFastForwardSnapshot() {
|
31
|
+
const [ordinal, snapshotIncremental, snapshotInfo] = await this.fetchLatestSnapshot();
|
32
|
+
const compressedSnapshotIncremental = await serializeBrotli(snapshotIncremental);
|
33
|
+
const compressedSnapshotInfo = await serializeBrotli(snapshotInfo);
|
34
|
+
const hash = await this.fetchSnapshotHash(ordinal);
|
35
|
+
// clm.debug('hash', Buffer.from(jsSha256.sha256(compressedSnapshotIncremental)).toString('hex'));
|
36
|
+
const snapshotInfoDir = path.join(this.dataDir, 'snapshot_info');
|
37
|
+
fs.mkdirSync(snapshotInfoDir, { recursive: true });
|
38
|
+
fs.writeFileSync(path.join(snapshotInfoDir, ordinal.toString()), compressedSnapshotInfo);
|
39
|
+
fs.writeFileSync(path.join(this.tmpDir, ordinal.toString() + '.c'), compressedSnapshotIncremental);
|
40
|
+
await this.saveSnapshotFiles(ordinal.toString(), hash);
|
41
|
+
clm.postStep('Fastforward completed.');
|
42
|
+
}
|
43
|
+
async fetchLatestSnapshot() {
|
44
|
+
const url = `${this.lbUrl}/global-snapshots/latest/combined`;
|
45
|
+
clm.debug('Fetching latest snapshot ordinal from: ' + chalk.cyan(url));
|
46
|
+
return fetch(url).then(res => res.json()
|
47
|
+
.then(data => {
|
48
|
+
const { ordinal } = data[0].value;
|
49
|
+
clm.debug('fetchLatestSnapshot - ' + chalk.cyan(ordinal));
|
50
|
+
return [ordinal, data[0], data[1]];
|
51
|
+
}));
|
52
|
+
}
|
53
|
+
async fetchSnapshot(ordinal) {
|
54
|
+
const url = `${this.lbUrl}/global-snapshots/${ordinal}`;
|
55
|
+
clm.debug('Fetching latest snapshot ordinal from: ' + url);
|
56
|
+
return fetch(url).then(res => res.json());
|
57
|
+
}
|
58
|
+
async fetchSnapshotHash(ordinal) {
|
59
|
+
const url = `${this.lbUrl}/global-snapshots/${ordinal}/hash`;
|
60
|
+
const hash = await fetch(url).then(res => res.text().then(t => t.replace(/^"(.*)"$/, '$1')));
|
61
|
+
clm.debug('fetchLatestSnapshotHash: ' + chalk.cyan(hash));
|
62
|
+
return hash;
|
63
|
+
}
|
64
|
+
async saveSnapshotFiles(ordinal, hash) {
|
65
|
+
const fileName = ordinal + '.c';
|
66
|
+
const ordinalFile = path.join(this.tmpDir, fileName);
|
67
|
+
if (!fs.existsSync(ordinalFile)) {
|
68
|
+
clm.error(`File ${ordinalFile} does not exist.`);
|
69
|
+
}
|
70
|
+
const ordinalRounded = Math.floor(Number(ordinal) / CHUNK_SIZE) * CHUNK_SIZE;
|
71
|
+
const hashSubdir = path.join(hash.slice(0, 3), hash.slice(3, 6));
|
72
|
+
// const snapshotInfoDir = path.join(OUTPUT_DIR, 'snapshot-info');
|
73
|
+
const incrementalSnapshotDir = path.join(this.dataDir, 'incremental_snapshot');
|
74
|
+
const hashDir = path.join(incrementalSnapshotDir, 'hash', hashSubdir);
|
75
|
+
const ordinalDir = path.join(incrementalSnapshotDir, 'ordinal', ordinalRounded.toString());
|
76
|
+
fs.mkdirSync(hashDir, { recursive: true });
|
77
|
+
fs.mkdirSync(ordinalDir, { recursive: true });
|
78
|
+
const destOrdinalFile = path.join(ordinalDir, ordinal);
|
79
|
+
fs.copyFileSync(ordinalFile, destOrdinalFile);
|
80
|
+
const hashFile = path.join(hashDir, hash);
|
81
|
+
fs.linkSync(destOrdinalFile, hashFile);
|
82
|
+
fs.writeFileSync(path.join(this.dataDir, 'snapshot-version'), `${this.network}:${ordinal}`);
|
83
|
+
}
|
84
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { NodeInfo, TessellationLayer } from "../types.js";
|
2
|
+
export declare const nodeService: {
|
3
|
+
getNodeInfo(layer: "first" | TessellationLayer): Promise<NodeInfo>;
|
4
|
+
getSnapshotHash(ipAddr: string, ordinal: number): Promise<string>;
|
5
|
+
joinCluster(layer: TessellationLayer): Promise<void>;
|
6
|
+
leaveCluster(layer: TessellationLayer): Promise<boolean>;
|
7
|
+
leaveClusterAllLayers(): Promise<boolean>;
|
8
|
+
pollForLayersState(layers: TessellationLayer[], state?: string): Promise<boolean>;
|
9
|
+
pollForState(layer: TessellationLayer, expectedState?: string): Promise<boolean>;
|
10
|
+
};
|
@@ -0,0 +1,117 @@
|
|
1
|
+
import { clm } from "../clm.js";
|
2
|
+
import { configStore } from "../config-store.js";
|
3
|
+
import { clusterService } from "./cluster-service.js";
|
4
|
+
import { shellService } from "./shell-service.js";
|
5
|
+
export const nodeService = {
|
6
|
+
async getNodeInfo(layer) {
|
7
|
+
if (layer === 'first') {
|
8
|
+
layer = configStore.getProjectInfo().layersToRun[0];
|
9
|
+
}
|
10
|
+
const portInfo = configStore.getLayerPortInfo(layer);
|
11
|
+
return fetch(`http://localhost:${portInfo.PUBLIC}/node/info`)
|
12
|
+
.then(res => {
|
13
|
+
if (res.ok)
|
14
|
+
return res.json().then(i => ({ ...i, layer }));
|
15
|
+
throw new Error(`Failed`);
|
16
|
+
})
|
17
|
+
.catch(() => ({ layer, state: "Unavailable" }));
|
18
|
+
},
|
19
|
+
async getSnapshotHash(ipAddr, ordinal) {
|
20
|
+
return fetch(`${ipAddr}/global-snapshots/${ordinal}/hash`)
|
21
|
+
.then(res => {
|
22
|
+
if (res.ok)
|
23
|
+
return res.json();
|
24
|
+
clm.warn(`Failed to get snapshot hash. Status code ${res.status}`);
|
25
|
+
return '';
|
26
|
+
})
|
27
|
+
.catch(() => (''));
|
28
|
+
},
|
29
|
+
async joinCluster(layer) {
|
30
|
+
const { state } = await this.getNodeInfo(layer);
|
31
|
+
if (state !== "ReadyToJoin") {
|
32
|
+
clm.warn(`Node is not ready to join the cluster. Current state: "${state}".`);
|
33
|
+
return;
|
34
|
+
}
|
35
|
+
const layerPortInfo = configStore.getLayerPortInfo(layer);
|
36
|
+
const peerInfo = await clusterService.getSourceNodeInfo();
|
37
|
+
const nodeId = peerInfo.id;
|
38
|
+
const nodeIp = peerInfo.host;
|
39
|
+
const cliPort = layerPortInfo.CLI;
|
40
|
+
const nodeP2pPort = peerInfo.p2pPort;
|
41
|
+
if (layer === 'gl0') {
|
42
|
+
await clusterService.fastForwardSnapshot();
|
43
|
+
}
|
44
|
+
// escape only the quotes in the body
|
45
|
+
const body = JSON.stringify({ id: nodeId, ip: nodeIp, p2pPort: nodeP2pPort }).replaceAll('"', String.raw `\"`);
|
46
|
+
const url = `http://localhost:${cliPort}/cluster/join`;
|
47
|
+
clm.preStep(`Joining ${layer} to cluster`); // on ${cliPort}...${body} ... ${url}`);
|
48
|
+
await shellService.execDockerShell(layer, `curl -X POST '${url}' -H 'Content-Type: application/json' --data '${body}'`);
|
49
|
+
await this.pollForState(layer, 'Ready');
|
50
|
+
},
|
51
|
+
async leaveCluster(layer) {
|
52
|
+
const { state } = await this.getNodeInfo(layer);
|
53
|
+
if (state === "Offline") {
|
54
|
+
clm.echo(`Node has already left the cluster. Current state: "${state}".`);
|
55
|
+
return true;
|
56
|
+
}
|
57
|
+
if (state === "ReadyToJoin") {
|
58
|
+
clm.echo(`Node has not joined the cluster yet. Current state: "${state}".`);
|
59
|
+
return true;
|
60
|
+
}
|
61
|
+
if (state === "Unavailable") {
|
62
|
+
clm.echo(`Node is not running.`);
|
63
|
+
return true;
|
64
|
+
}
|
65
|
+
const { CLI: cliPort } = configStore.getLayerPortInfo(layer);
|
66
|
+
clm.preStep(`${layer} is leaving the cluster. Current state: "${state}"`);
|
67
|
+
return shellService.execDockerShell(layer, `curl -X POST 'http://localhost:${cliPort}/cluster/leave'`)
|
68
|
+
.then(() => true)
|
69
|
+
.catch(() => false);
|
70
|
+
},
|
71
|
+
async leaveClusterAllLayers() {
|
72
|
+
const layers = configStore.getProjectInfo().layersToRun;
|
73
|
+
const promises = layers.map(l => this.leaveCluster(l));
|
74
|
+
const results = await Promise.all(promises);
|
75
|
+
return results.every(Boolean);
|
76
|
+
},
|
77
|
+
async pollForLayersState(layers, state = 'ReadyToJoin') {
|
78
|
+
for (const layer of layers) {
|
79
|
+
// eslint-disable-next-line no-await-in-loop
|
80
|
+
const readyToJoin = await this.pollForState(layer, state);
|
81
|
+
if (!readyToJoin) {
|
82
|
+
return false;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
return true;
|
86
|
+
},
|
87
|
+
async pollForState(layer, expectedState = 'ReadyToJoin') {
|
88
|
+
clm.preStep(`Waiting for ${layer.toUpperCase()} Validator Node to become ${expectedState}...`);
|
89
|
+
await sleep(1);
|
90
|
+
for (let i = 1; i <= 60; i++) {
|
91
|
+
// eslint-disable-next-line no-await-in-loop
|
92
|
+
const { state } = await this.getNodeInfo(layer);
|
93
|
+
if (state === "Unavailable" || state === "ReadyToJoin") {
|
94
|
+
if (expectedState === 'Offline')
|
95
|
+
return true;
|
96
|
+
clm.echo(` Validator Node is not running.`);
|
97
|
+
}
|
98
|
+
if (layer === 'gl0' && expectedState === 'Ready' && state === "WaitingForDownload") {
|
99
|
+
clm.echo(` [${layer}] Attempt ${i}: Current state is "${state}"`);
|
100
|
+
}
|
101
|
+
else {
|
102
|
+
clm.echo(` [${layer}] Attempt ${i}: Current state is "${state}"`);
|
103
|
+
}
|
104
|
+
if (state === expectedState) {
|
105
|
+
clm.postStep(` ${layer} is ${expectedState}`);
|
106
|
+
return true;
|
107
|
+
}
|
108
|
+
// eslint-disable-next-line no-await-in-loop
|
109
|
+
await sleep(5);
|
110
|
+
}
|
111
|
+
clm.warn(` ${layer} is not ${expectedState} after 5 minutes`);
|
112
|
+
return false;
|
113
|
+
}
|
114
|
+
};
|
115
|
+
function sleep(sec) {
|
116
|
+
return new Promise(resolve => { setTimeout(resolve, sec * 1000); });
|
117
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import shell from "shelljs";
|
2
|
+
export declare const shellService: {
|
3
|
+
checkCommandAvailable(cmd: string): Promise<boolean>;
|
4
|
+
execDockerShell(serviceName: string, command: string): Promise<string>;
|
5
|
+
existsScript(filePath: string): boolean;
|
6
|
+
resolvePath(keyPath: string): string;
|
7
|
+
runCommand(command: string, env?: object, silent?: boolean): Promise<shell.ShellString>;
|
8
|
+
runCommandWithOutput(command: string, env?: object): Promise<string>;
|
9
|
+
};
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import fs from "node:fs";
|
2
|
+
import os from "node:os";
|
3
|
+
import path from "node:path";
|
4
|
+
import shell from "shelljs";
|
5
|
+
import { clm } from "../clm.js";
|
6
|
+
import { configStore } from "../config-store.js";
|
7
|
+
export const shellService = {
|
8
|
+
async checkCommandAvailable(cmd) {
|
9
|
+
return this.runCommand(`command -v ${cmd}`, undefined, true)
|
10
|
+
.then(() => true)
|
11
|
+
.catch(() => false);
|
12
|
+
},
|
13
|
+
async execDockerShell(serviceName, command) {
|
14
|
+
const { projectDir } = configStore.getProjectInfo();
|
15
|
+
clm.debug(`Running command: docker compose exec ${serviceName} bash -c "${command}"`);
|
16
|
+
const result = shell.exec(`docker compose exec ${serviceName} bash -c "${command}"`, { cwd: projectDir, silent: true });
|
17
|
+
if (result.stderr && result.code > 0) {
|
18
|
+
clm.error(`Command Failed - ${command} with stderr: ${result.stderr}`);
|
19
|
+
}
|
20
|
+
return result.stdout;
|
21
|
+
},
|
22
|
+
existsScript(filePath) {
|
23
|
+
const { projectDir } = configStore.getProjectInfo();
|
24
|
+
return fs.existsSync(path.join(projectDir, filePath));
|
25
|
+
},
|
26
|
+
resolvePath(keyPath) {
|
27
|
+
if (keyPath.startsWith('~/')) {
|
28
|
+
return path.join(os.homedir(), keyPath.slice(2));
|
29
|
+
}
|
30
|
+
if (keyPath.startsWith('/')) {
|
31
|
+
return keyPath;
|
32
|
+
}
|
33
|
+
return path.resolve(process.cwd(), keyPath);
|
34
|
+
},
|
35
|
+
async runCommand(command, env, silent = false) {
|
36
|
+
const { projectDir } = configStore.getProjectInfo();
|
37
|
+
let nodeEnv;
|
38
|
+
if (env) {
|
39
|
+
nodeEnv = { ...env, ...process.env };
|
40
|
+
}
|
41
|
+
clm.debug(`START Running command: "${command}" in directory: "${projectDir}"`);
|
42
|
+
const result = shell.exec(command, { cwd: projectDir, env: nodeEnv, silent });
|
43
|
+
clm.debug(`END ${command}. Exit code: ${result.code}`);
|
44
|
+
if (result.code > 0) {
|
45
|
+
throw new Error(`Failed running command: ${result.stderr}`);
|
46
|
+
}
|
47
|
+
return result;
|
48
|
+
},
|
49
|
+
async runCommandWithOutput(command, env) {
|
50
|
+
const result = await this.runCommand(command, env, true);
|
51
|
+
return result.stdout.trim();
|
52
|
+
}
|
53
|
+
};
|
package/dist/styles.d.ts
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
export declare const blue: (m: boolean | number | string) => string;
|
2
|
+
export declare const green: (m: boolean | number | string) => string;
|
3
|
+
export declare const red: (m: boolean | number | string) => string;
|
4
|
+
export declare const cyan: (m: boolean | number | string) => string;
|
package/dist/styles.js
ADDED
package/dist/types.d.ts
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
export type TessellationLayer = 'cl1' | 'dl1' | 'gl0' | 'gl1' | 'ml0';
|
2
|
+
export type NodeInfo = {
|
3
|
+
clusterSession: number;
|
4
|
+
host: string;
|
5
|
+
id: string;
|
6
|
+
layer: TessellationLayer;
|
7
|
+
p2pPort: number;
|
8
|
+
publicPort: number;
|
9
|
+
session: number;
|
10
|
+
state: string;
|
11
|
+
version: string;
|
12
|
+
};
|
13
|
+
export type ClusterInfo = {
|
14
|
+
clusterSession: string;
|
15
|
+
id: string;
|
16
|
+
ip: string;
|
17
|
+
jar: string;
|
18
|
+
p2pPort: number;
|
19
|
+
publicPort: number;
|
20
|
+
session: string;
|
21
|
+
state: 'DownloadInProgress' | 'GenesisReady' | 'Initial' | 'Leaving' | 'LoadingGenesis' | 'Offline' | 'Ready' | 'ReadyToJoin' | 'SessionStarted' | 'StartingSession' | 'Unavailable' | 'WaitingForDownload';
|
22
|
+
};
|
package/dist/types.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,241 @@
|
|
1
|
+
{
|
2
|
+
"commands": {
|
3
|
+
"config": {
|
4
|
+
"aliases": [],
|
5
|
+
"args": {},
|
6
|
+
"description": "Update configuration settings",
|
7
|
+
"examples": [
|
8
|
+
"<%= config.bin %> <%= command.id %>"
|
9
|
+
],
|
10
|
+
"flags": {},
|
11
|
+
"hasDynamicHelp": false,
|
12
|
+
"hiddenAliases": [],
|
13
|
+
"id": "config",
|
14
|
+
"pluginAlias": "@constellation-network/node-pilot",
|
15
|
+
"pluginName": "@constellation-network/node-pilot",
|
16
|
+
"pluginType": "core",
|
17
|
+
"strict": true,
|
18
|
+
"enableJsonFlag": false,
|
19
|
+
"isESM": true,
|
20
|
+
"relativePath": [
|
21
|
+
"dist",
|
22
|
+
"commands",
|
23
|
+
"config.js"
|
24
|
+
]
|
25
|
+
},
|
26
|
+
"info": {
|
27
|
+
"aliases": [],
|
28
|
+
"args": {},
|
29
|
+
"description": "Display general info about the validator node",
|
30
|
+
"examples": [
|
31
|
+
"<%= config.bin %> <%= command.id %>"
|
32
|
+
],
|
33
|
+
"flags": {},
|
34
|
+
"hasDynamicHelp": false,
|
35
|
+
"hiddenAliases": [],
|
36
|
+
"id": "info",
|
37
|
+
"pluginAlias": "@constellation-network/node-pilot",
|
38
|
+
"pluginName": "@constellation-network/node-pilot",
|
39
|
+
"pluginType": "core",
|
40
|
+
"strict": true,
|
41
|
+
"enableJsonFlag": false,
|
42
|
+
"isESM": true,
|
43
|
+
"relativePath": [
|
44
|
+
"dist",
|
45
|
+
"commands",
|
46
|
+
"info.js"
|
47
|
+
]
|
48
|
+
},
|
49
|
+
"logs": {
|
50
|
+
"aliases": [],
|
51
|
+
"args": {
|
52
|
+
"layer": {
|
53
|
+
"description": "network layer to view. e.g. gl0",
|
54
|
+
"name": "layer"
|
55
|
+
}
|
56
|
+
},
|
57
|
+
"description": "view validator node runtime logs",
|
58
|
+
"examples": [
|
59
|
+
"<%= config.bin %> <%= command.id %>"
|
60
|
+
],
|
61
|
+
"flags": {
|
62
|
+
"follow": {
|
63
|
+
"char": "f",
|
64
|
+
"description": "continuously wait for additional data to be appended",
|
65
|
+
"name": "follow",
|
66
|
+
"allowNo": false,
|
67
|
+
"type": "boolean"
|
68
|
+
}
|
69
|
+
},
|
70
|
+
"hasDynamicHelp": false,
|
71
|
+
"hiddenAliases": [],
|
72
|
+
"id": "logs",
|
73
|
+
"pluginAlias": "@constellation-network/node-pilot",
|
74
|
+
"pluginName": "@constellation-network/node-pilot",
|
75
|
+
"pluginType": "core",
|
76
|
+
"strict": true,
|
77
|
+
"enableJsonFlag": false,
|
78
|
+
"isESM": true,
|
79
|
+
"relativePath": [
|
80
|
+
"dist",
|
81
|
+
"commands",
|
82
|
+
"logs.js"
|
83
|
+
]
|
84
|
+
},
|
85
|
+
"restart": {
|
86
|
+
"aliases": [],
|
87
|
+
"args": {},
|
88
|
+
"description": "A full shutdown of the validator node, then restart",
|
89
|
+
"examples": [
|
90
|
+
"<%= config.bin %> <%= command.id %>"
|
91
|
+
],
|
92
|
+
"flags": {},
|
93
|
+
"hasDynamicHelp": false,
|
94
|
+
"hiddenAliases": [],
|
95
|
+
"id": "restart",
|
96
|
+
"pluginAlias": "@constellation-network/node-pilot",
|
97
|
+
"pluginName": "@constellation-network/node-pilot",
|
98
|
+
"pluginType": "core",
|
99
|
+
"strict": true,
|
100
|
+
"enableJsonFlag": false,
|
101
|
+
"isESM": true,
|
102
|
+
"relativePath": [
|
103
|
+
"dist",
|
104
|
+
"commands",
|
105
|
+
"restart.js"
|
106
|
+
]
|
107
|
+
},
|
108
|
+
"shutdown": {
|
109
|
+
"aliases": [],
|
110
|
+
"args": {},
|
111
|
+
"description": "A full shutdown of the validator node",
|
112
|
+
"examples": [
|
113
|
+
"<%= config.bin %> <%= command.id %>"
|
114
|
+
],
|
115
|
+
"flags": {},
|
116
|
+
"hasDynamicHelp": false,
|
117
|
+
"hiddenAliases": [],
|
118
|
+
"id": "shutdown",
|
119
|
+
"pluginAlias": "@constellation-network/node-pilot",
|
120
|
+
"pluginName": "@constellation-network/node-pilot",
|
121
|
+
"pluginType": "core",
|
122
|
+
"strict": true,
|
123
|
+
"enableJsonFlag": false,
|
124
|
+
"isESM": true,
|
125
|
+
"relativePath": [
|
126
|
+
"dist",
|
127
|
+
"commands",
|
128
|
+
"shutdown.js"
|
129
|
+
]
|
130
|
+
},
|
131
|
+
"status": {
|
132
|
+
"aliases": [],
|
133
|
+
"args": {},
|
134
|
+
"description": "Display node status and configuration settings",
|
135
|
+
"flags": {},
|
136
|
+
"hasDynamicHelp": false,
|
137
|
+
"hiddenAliases": [],
|
138
|
+
"id": "status",
|
139
|
+
"pluginAlias": "@constellation-network/node-pilot",
|
140
|
+
"pluginName": "@constellation-network/node-pilot",
|
141
|
+
"pluginType": "core",
|
142
|
+
"strict": true,
|
143
|
+
"enableJsonFlag": false,
|
144
|
+
"isESM": true,
|
145
|
+
"relativePath": [
|
146
|
+
"dist",
|
147
|
+
"commands",
|
148
|
+
"status.js"
|
149
|
+
]
|
150
|
+
},
|
151
|
+
"test": {
|
152
|
+
"aliases": [],
|
153
|
+
"args": {},
|
154
|
+
"description": "node pilot test command",
|
155
|
+
"flags": {},
|
156
|
+
"hasDynamicHelp": false,
|
157
|
+
"hidden": true,
|
158
|
+
"hiddenAliases": [],
|
159
|
+
"id": "test",
|
160
|
+
"pluginAlias": "@constellation-network/node-pilot",
|
161
|
+
"pluginName": "@constellation-network/node-pilot",
|
162
|
+
"pluginType": "core",
|
163
|
+
"strict": true,
|
164
|
+
"enableJsonFlag": false,
|
165
|
+
"isESM": true,
|
166
|
+
"relativePath": [
|
167
|
+
"dist",
|
168
|
+
"commands",
|
169
|
+
"test.js"
|
170
|
+
]
|
171
|
+
},
|
172
|
+
"config:get": {
|
173
|
+
"aliases": [],
|
174
|
+
"args": {
|
175
|
+
"name": {
|
176
|
+
"description": "configuration to get",
|
177
|
+
"name": "name"
|
178
|
+
}
|
179
|
+
},
|
180
|
+
"description": "Show all configuration settings or a specific one",
|
181
|
+
"examples": [
|
182
|
+
"<%= config.bin %> <%= command.id %>",
|
183
|
+
"<%= config.bin %> <%= command.id %> CL_EXTERNAL_IP",
|
184
|
+
"<%= config.bin %> <%= command.id %> gl0:CL_PUBLIC_HTTP_PORT"
|
185
|
+
],
|
186
|
+
"flags": {},
|
187
|
+
"hasDynamicHelp": false,
|
188
|
+
"hiddenAliases": [],
|
189
|
+
"id": "config:get",
|
190
|
+
"pluginAlias": "@constellation-network/node-pilot",
|
191
|
+
"pluginName": "@constellation-network/node-pilot",
|
192
|
+
"pluginType": "core",
|
193
|
+
"strict": true,
|
194
|
+
"enableJsonFlag": false,
|
195
|
+
"isESM": true,
|
196
|
+
"relativePath": [
|
197
|
+
"dist",
|
198
|
+
"commands",
|
199
|
+
"config",
|
200
|
+
"get.js"
|
201
|
+
]
|
202
|
+
},
|
203
|
+
"config:set": {
|
204
|
+
"aliases": [],
|
205
|
+
"args": {
|
206
|
+
"name": {
|
207
|
+
"description": "configuration name",
|
208
|
+
"name": "name",
|
209
|
+
"required": true
|
210
|
+
},
|
211
|
+
"value": {
|
212
|
+
"description": "the value to set to the configuration",
|
213
|
+
"name": "value",
|
214
|
+
"required": true
|
215
|
+
}
|
216
|
+
},
|
217
|
+
"description": "Set a configuration setting",
|
218
|
+
"examples": [
|
219
|
+
"<%= config.bin %> <%= command.id %> CL_EXTERNAL_IP 127.0.0.1",
|
220
|
+
"<%= config.bin %> <%= command.id %> gl0:CL_PUBLIC_HTTP_PORT 9000"
|
221
|
+
],
|
222
|
+
"flags": {},
|
223
|
+
"hasDynamicHelp": false,
|
224
|
+
"hiddenAliases": [],
|
225
|
+
"id": "config:set",
|
226
|
+
"pluginAlias": "@constellation-network/node-pilot",
|
227
|
+
"pluginName": "@constellation-network/node-pilot",
|
228
|
+
"pluginType": "core",
|
229
|
+
"strict": true,
|
230
|
+
"enableJsonFlag": false,
|
231
|
+
"isESM": true,
|
232
|
+
"relativePath": [
|
233
|
+
"dist",
|
234
|
+
"commands",
|
235
|
+
"config",
|
236
|
+
"set.js"
|
237
|
+
]
|
238
|
+
}
|
239
|
+
},
|
240
|
+
"version": "0.0.1"
|
241
|
+
}
|
package/package.json
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
{
|
2
|
+
"name": "@constellation-network/node-pilot",
|
3
|
+
"description": "An easy deployment and monitoring tool for Constellation nodes.",
|
4
|
+
"version": "0.0.1",
|
5
|
+
"author": "Frank Fox",
|
6
|
+
"bin": {
|
7
|
+
"cpilot": "bin/run.js"
|
8
|
+
},
|
9
|
+
"bugs": "https://github.com/Constellation-Labs/node-pilot/issues",
|
10
|
+
"repository": {
|
11
|
+
"type": "git",
|
12
|
+
"url": "git+https://github.com/Constellation-Labs/node-pilot.git"
|
13
|
+
},
|
14
|
+
"scripts": {
|
15
|
+
"build": "shx rm -rf dist && tsc -b",
|
16
|
+
"lint": "eslint",
|
17
|
+
"postpack": "shx rm -f oclif.manifest.json",
|
18
|
+
"posttest": "yarn lint",
|
19
|
+
"prepack": "oclif manifest && oclif readme",
|
20
|
+
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
|
21
|
+
"version": "oclif readme && git add README.md",
|
22
|
+
"start": "./bin/dev.js",
|
23
|
+
"debug": "DEBUG=true ./bin/dev.js",
|
24
|
+
"publish": "npm publish --access public"
|
25
|
+
},
|
26
|
+
"types": "dist/index.d.ts",
|
27
|
+
"engines": {
|
28
|
+
"node": ">=22.3.0"
|
29
|
+
},
|
30
|
+
"dependencies": {
|
31
|
+
"@inquirer/prompts": "^7.8.0",
|
32
|
+
"@oclif/core": "^4",
|
33
|
+
"@oclif/plugin-help": "^6",
|
34
|
+
"@oclif/plugin-plugins": "^5",
|
35
|
+
"@stardust-collective/dag4-keystore": "^2.6.0",
|
36
|
+
"chalk": "^5.5.0",
|
37
|
+
"dotenv": "^17.2.1",
|
38
|
+
"js-sha256": "^0.11.1",
|
39
|
+
"json-bigint-patch": "^0.0.8",
|
40
|
+
"node-localstorage": "^3.0.5",
|
41
|
+
"shelljs": "^0.10.0",
|
42
|
+
"tty-table": "^4.2.3"
|
43
|
+
},
|
44
|
+
"devDependencies": {
|
45
|
+
"@eslint/compat": "^1",
|
46
|
+
"@oclif/prettier-config": "^0.2.1",
|
47
|
+
"@oclif/test": "^4",
|
48
|
+
"@types/chai": "^4",
|
49
|
+
"@types/mocha": "^10",
|
50
|
+
"@types/node": "^22.17.1",
|
51
|
+
"@types/node-localstorage": "^1.3.3",
|
52
|
+
"@types/shelljs": "^0.8.17",
|
53
|
+
"chai": "^4",
|
54
|
+
"eslint": "^9",
|
55
|
+
"eslint-config-oclif": "^6",
|
56
|
+
"eslint-config-prettier": "^10",
|
57
|
+
"mocha": "^10",
|
58
|
+
"oclif": "^4",
|
59
|
+
"shx": "^0.3.3",
|
60
|
+
"ts-node": "^10.9.2",
|
61
|
+
"typescript": "^5"
|
62
|
+
},
|
63
|
+
"files": [
|
64
|
+
"./bin",
|
65
|
+
"./dist",
|
66
|
+
"./oclif.manifest.json",
|
67
|
+
"./projects",
|
68
|
+
"./README.md"
|
69
|
+
],
|
70
|
+
"homepage": "https://github.com/Constellation-Labs/node-pilot",
|
71
|
+
"keywords": [
|
72
|
+
"constellation network",
|
73
|
+
"validator",
|
74
|
+
"node"
|
75
|
+
],
|
76
|
+
"license": "MIT",
|
77
|
+
"main": "dist/index.js",
|
78
|
+
"type": "module",
|
79
|
+
"oclif": {
|
80
|
+
"bin": "cpilot",
|
81
|
+
"dirname": "cpilot",
|
82
|
+
"commands": {
|
83
|
+
"default": "status",
|
84
|
+
"strategy": "pattern",
|
85
|
+
"target": "./dist/commands"
|
86
|
+
},
|
87
|
+
"plugins": [
|
88
|
+
"@oclif/plugin-help"
|
89
|
+
],
|
90
|
+
"additionalHelpFlags": [
|
91
|
+
"-h"
|
92
|
+
],
|
93
|
+
"additionalVersionFlags": [
|
94
|
+
"-v"
|
95
|
+
],
|
96
|
+
"topicSeparator": " "
|
97
|
+
}
|
98
|
+
}
|