@cig-technology/cli 0.1.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.
- package/LICENSE +21 -0
- package/README.md +42 -0
- package/dist/commands/bootstrap-reset.d.ts +14 -0
- package/dist/commands/bootstrap-reset.d.ts.map +1 -0
- package/dist/commands/bootstrap-reset.js +93 -0
- package/dist/commands/bootstrap-reset.js.map +1 -0
- package/dist/commands/bootstrap.d.ts +18 -0
- package/dist/commands/bootstrap.d.ts.map +1 -0
- package/dist/commands/bootstrap.js +106 -0
- package/dist/commands/bootstrap.js.map +1 -0
- package/dist/commands/connect.d.ts +4 -0
- package/dist/commands/connect.d.ts.map +1 -0
- package/dist/commands/connect.js +46 -0
- package/dist/commands/connect.js.map +1 -0
- package/dist/commands/doctor.d.ts +11 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +57 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/enroll.d.ts +7 -0
- package/dist/commands/enroll.d.ts.map +1 -0
- package/dist/commands/enroll.js +13 -0
- package/dist/commands/enroll.js.map +1 -0
- package/dist/commands/enrollment.d.ts +12 -0
- package/dist/commands/enrollment.d.ts.map +1 -0
- package/dist/commands/enrollment.js +106 -0
- package/dist/commands/enrollment.js.map +1 -0
- package/dist/commands/install.d.ts +2 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +219 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/login.d.ts +14 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +120 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +10 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +38 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/open.d.ts +2 -0
- package/dist/commands/open.d.ts.map +1 -0
- package/dist/commands/open.js +17 -0
- package/dist/commands/open.js.map +1 -0
- package/dist/commands/permissions.d.ts +2 -0
- package/dist/commands/permissions.d.ts.map +1 -0
- package/dist/commands/permissions.js +17 -0
- package/dist/commands/permissions.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +31 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/uninstall.d.ts +2 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +61 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/upgrade.d.ts +2 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +14 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/compose-generator.d.ts +23 -0
- package/dist/compose-generator.d.ts.map +1 -0
- package/dist/compose-generator.js +214 -0
- package/dist/compose-generator.js.map +1 -0
- package/dist/credentials.d.ts +69 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +178 -0
- package/dist/credentials.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +151 -0
- package/dist/index.js.map +1 -0
- package/dist/managers/state-manager.d.ts +25 -0
- package/dist/managers/state-manager.d.ts.map +1 -0
- package/dist/managers/state-manager.js +76 -0
- package/dist/managers/state-manager.js.map +1 -0
- package/dist/platform.d.ts +20 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +95 -0
- package/dist/platform.js.map +1 -0
- package/dist/prereqs.d.ts +48 -0
- package/dist/prereqs.d.ts.map +1 -0
- package/dist/prereqs.js +242 -0
- package/dist/prereqs.js.map +1 -0
- package/dist/services/api-client.d.ts +24 -0
- package/dist/services/api-client.d.ts.map +1 -0
- package/dist/services/api-client.js +66 -0
- package/dist/services/api-client.js.map +1 -0
- package/dist/services/install-planner.d.ts +18 -0
- package/dist/services/install-planner.d.ts.map +1 -0
- package/dist/services/install-planner.js +32 -0
- package/dist/services/install-planner.js.map +1 -0
- package/dist/services/node-bundle-installer.d.ts +12 -0
- package/dist/services/node-bundle-installer.d.ts.map +1 -0
- package/dist/services/node-bundle-installer.js +65 -0
- package/dist/services/node-bundle-installer.js.map +1 -0
- package/dist/services/remote-executor.d.ts +5 -0
- package/dist/services/remote-executor.d.ts.map +1 -0
- package/dist/services/remote-executor.js +13 -0
- package/dist/services/remote-executor.js.map +1 -0
- package/dist/storage/paths.d.ts +16 -0
- package/dist/storage/paths.d.ts.map +1 -0
- package/dist/storage/paths.js +54 -0
- package/dist/storage/paths.js.map +1 -0
- package/dist/stores/cli-secret-store.d.ts +20 -0
- package/dist/stores/cli-secret-store.d.ts.map +1 -0
- package/dist/stores/cli-secret-store.js +105 -0
- package/dist/stores/cli-secret-store.js.map +1 -0
- package/dist/stores/connection-profile-store.d.ts +15 -0
- package/dist/stores/connection-profile-store.d.ts.map +1 -0
- package/dist/stores/connection-profile-store.js +104 -0
- package/dist/stores/connection-profile-store.js.map +1 -0
- package/dist/types/runtime.d.ts +46 -0
- package/dist/types/runtime.d.ts.map +1 -0
- package/dist/types/runtime.js +3 -0
- package/dist/types/runtime.js.map +1 -0
- package/dist/utils/crypto.d.ts +6 -0
- package/dist/utils/crypto.d.ts.map +1 -0
- package/dist/utils/crypto.js +54 -0
- package/dist/utils/crypto.js.map +1 -0
- package/dist/utils/systemd.d.ts +8 -0
- package/dist/utils/systemd.d.ts.map +1 -0
- package/dist/utils/systemd.js +24 -0
- package/dist/utils/systemd.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/dist/wizard.d.ts +14 -0
- package/dist/wizard.d.ts.map +1 -0
- package/dist/wizard.js +154 -0
- package/dist/wizard.js.map +1 -0
- package/package.json +60 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const login_js_1 = require("./commands/login.js");
|
|
6
|
+
const logout_js_1 = require("./commands/logout.js");
|
|
7
|
+
const doctor_js_1 = require("./commands/doctor.js");
|
|
8
|
+
const install_js_1 = require("./commands/install.js");
|
|
9
|
+
const bootstrap_reset_js_1 = require("./commands/bootstrap-reset.js");
|
|
10
|
+
const connect_js_1 = require("./commands/connect.js");
|
|
11
|
+
const enroll_js_1 = require("./commands/enroll.js");
|
|
12
|
+
const permissions_js_1 = require("./commands/permissions.js");
|
|
13
|
+
const status_js_1 = require("./commands/status.js");
|
|
14
|
+
const open_js_1 = require("./commands/open.js");
|
|
15
|
+
const upgrade_js_1 = require("./commands/upgrade.js");
|
|
16
|
+
const uninstall_js_1 = require("./commands/uninstall.js");
|
|
17
|
+
const version_js_1 = require("./version.js");
|
|
18
|
+
const program = new commander_1.Command();
|
|
19
|
+
program.name('cig').description('Compute Intelligence Graph CLI').version(version_js_1.CLI_VERSION);
|
|
20
|
+
program
|
|
21
|
+
.command('login')
|
|
22
|
+
.description('Authenticate via device authorization flow')
|
|
23
|
+
.option('--api-url <url>', 'API URL', 'http://localhost:8000')
|
|
24
|
+
.action((opts) => {
|
|
25
|
+
(0, login_js_1.login)(opts.apiUrl).catch((err) => {
|
|
26
|
+
console.error('Error during login:', err);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
program
|
|
31
|
+
.command('logout')
|
|
32
|
+
.description('Clear stored credentials and logout')
|
|
33
|
+
.option('--api-url <url>', 'API URL', 'http://localhost:8000')
|
|
34
|
+
.action((opts) => {
|
|
35
|
+
(0, logout_js_1.logout)(opts.apiUrl).catch((err) => {
|
|
36
|
+
console.error('Error during logout:', err);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
program
|
|
41
|
+
.command('doctor')
|
|
42
|
+
.description('Run prerequisite checks and display system readiness')
|
|
43
|
+
.action(() => {
|
|
44
|
+
(0, doctor_js_1.doctor)().catch((err) => {
|
|
45
|
+
console.error('Error during doctor check:', err);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
program
|
|
50
|
+
.command('install')
|
|
51
|
+
.description('Install CIG in managed or self-hosted mode')
|
|
52
|
+
.option('--mode <mode>', 'Installation mode: managed or self-hosted')
|
|
53
|
+
.option('--profile <profile>', 'Installation profile: core or full')
|
|
54
|
+
.option('--api-url <url>', 'API URL', 'http://localhost:8000')
|
|
55
|
+
.action((opts) => {
|
|
56
|
+
(0, install_js_1.install)(opts.apiUrl, opts.mode, opts.profile).catch((err) => {
|
|
57
|
+
console.error('Error during install:', err);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
program
|
|
62
|
+
.command('enroll')
|
|
63
|
+
.description('Enroll a node against the current control plane')
|
|
64
|
+
.option('--api-url <url>', 'API URL', 'http://localhost:8000')
|
|
65
|
+
.option('--profile <profile>', 'Install profile: core or full', 'core')
|
|
66
|
+
.option('--token <token>', 'Pre-issued enrollment token')
|
|
67
|
+
.action((opts) => {
|
|
68
|
+
(0, enroll_js_1.enroll)({
|
|
69
|
+
apiUrl: opts.apiUrl,
|
|
70
|
+
profile: opts.profile,
|
|
71
|
+
token: opts.token,
|
|
72
|
+
}).catch((err) => {
|
|
73
|
+
console.error('Error during enrollment:', err);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
program
|
|
78
|
+
.command('bootstrap-reset')
|
|
79
|
+
.description('Generate and display a new bootstrap token for self-hosted mode')
|
|
80
|
+
.action(() => {
|
|
81
|
+
(0, bootstrap_reset_js_1.bootstrapReset)().catch((err) => {
|
|
82
|
+
console.error('Error during bootstrap reset:', err);
|
|
83
|
+
process.exit(1);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
const connect = program.command('connect').description('Configure discovery and API connection profiles');
|
|
87
|
+
connect
|
|
88
|
+
.command('aws')
|
|
89
|
+
.description('Save the AWS AssumeRole ARN for discovery')
|
|
90
|
+
.requiredOption('--role-arn <arn>', 'AWS IAM role ARN')
|
|
91
|
+
.action((opts) => (0, connect_js_1.connectAws)(opts.roleArn));
|
|
92
|
+
connect
|
|
93
|
+
.command('gcp')
|
|
94
|
+
.description('Save the GCP service account JSON path for discovery')
|
|
95
|
+
.requiredOption('--service-account <path>', 'Path to the GCP service account JSON file')
|
|
96
|
+
.action((opts) => (0, connect_js_1.connectGcp)(opts.serviceAccount));
|
|
97
|
+
connect
|
|
98
|
+
.command('api')
|
|
99
|
+
.description('Save a direct API connection profile')
|
|
100
|
+
.requiredOption('--url <url>', 'API base URL')
|
|
101
|
+
.option('--auth-mode <mode>', 'managed, self-hosted, or none', 'none')
|
|
102
|
+
.action((opts) => (0, connect_js_1.connectApi)(opts.url, opts.authMode));
|
|
103
|
+
program
|
|
104
|
+
.command('permissions')
|
|
105
|
+
.description('Display the CIG permission tier model')
|
|
106
|
+
.action(() => {
|
|
107
|
+
(0, permissions_js_1.permissions)().catch((err) => {
|
|
108
|
+
console.error('Error during permissions command:', err);
|
|
109
|
+
process.exit(1);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
program
|
|
113
|
+
.command('status')
|
|
114
|
+
.description('Show installation and connection status')
|
|
115
|
+
.option('--json', 'Output status as JSON')
|
|
116
|
+
.action((opts) => {
|
|
117
|
+
(0, status_js_1.status)(Boolean(opts.json)).catch((err) => {
|
|
118
|
+
console.error('Error during status command:', err);
|
|
119
|
+
process.exit(1);
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
program
|
|
123
|
+
.command('open')
|
|
124
|
+
.description('Print the dashboard URL for the active installation/profile')
|
|
125
|
+
.action(() => {
|
|
126
|
+
(0, open_js_1.openDashboard)().catch((err) => {
|
|
127
|
+
console.error('Error during open command:', err);
|
|
128
|
+
process.exit(1);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
program
|
|
132
|
+
.command('upgrade')
|
|
133
|
+
.description('Prepare the current installation for a bundle upgrade')
|
|
134
|
+
.action(() => {
|
|
135
|
+
(0, upgrade_js_1.upgrade)().catch((err) => {
|
|
136
|
+
console.error('Error during upgrade:', err);
|
|
137
|
+
process.exit(1);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
program
|
|
141
|
+
.command('uninstall')
|
|
142
|
+
.description('Remove installation metadata and optionally purge runtime files')
|
|
143
|
+
.option('--purge-data', 'Delete the installation directory as well')
|
|
144
|
+
.action((opts) => {
|
|
145
|
+
(0, uninstall_js_1.uninstall)(Boolean(opts.purgeData)).catch((err) => {
|
|
146
|
+
console.error('Error during uninstall:', err);
|
|
147
|
+
process.exit(1);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
program.parse();
|
|
151
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,yCAAoC;AACpC,kDAA4C;AAC5C,oDAA8C;AAC9C,oDAA8C;AAC9C,sDAAgD;AAChD,sEAA+D;AAC/D,sDAA2E;AAC3E,oDAA8C;AAC9C,8DAAwD;AACxD,oDAA8C;AAC9C,gDAAmD;AACnD,sDAAgD;AAChD,0DAAoD;AACpD,6CAA2C;AAE3C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,gCAAgC,CAAC,CAAC,OAAO,CAAC,wBAAW,CAAC,CAAC;AAEvF,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,4CAA4C,CAAC;KACzD,MAAM,CAAC,iBAAiB,EAAE,SAAS,EAAE,uBAAuB,CAAC;KAC7D,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;IACf,IAAA,gBAAK,EAAC,IAAI,CAAC,MAAM,CAAC,CA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AA,wBAAS,EAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QAC/C,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CliPathOptions } from '../storage/paths.js';
|
|
2
|
+
export interface InstallationState {
|
|
3
|
+
version: string;
|
|
4
|
+
mode: 'managed' | 'self-hosted';
|
|
5
|
+
profile: 'core' | 'full';
|
|
6
|
+
installDir: string;
|
|
7
|
+
installedAt: string;
|
|
8
|
+
status: 'ready' | 'running' | 'stopped' | 'degraded' | 'failed';
|
|
9
|
+
services: ServiceState[];
|
|
10
|
+
}
|
|
11
|
+
export interface ServiceState {
|
|
12
|
+
name: string;
|
|
13
|
+
status: 'running' | 'stopped' | 'restarting' | 'unhealthy';
|
|
14
|
+
containerId?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class StateManager {
|
|
17
|
+
private readonly stateFile;
|
|
18
|
+
constructor(pathOptions?: CliPathOptions);
|
|
19
|
+
save(state: InstallationState): Promise<void>;
|
|
20
|
+
load(): Promise<InstallationState | null>;
|
|
21
|
+
update(updates: Partial<InstallationState>): Promise<void>;
|
|
22
|
+
delete(): Promise<void>;
|
|
23
|
+
validateInstallDir(state: InstallationState): Promise<boolean>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=state-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-manager.d.ts","sourceRoot":"","sources":["../../src/managers/state-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAmB,MAAM,qBAAqB,CAAC;AAEtE,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,GAAG,aAAa,CAAC;IAChC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAChE,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,CAAC;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,WAAW,GAAE,cAAmB;IAItC,IAAI,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ7C,IAAI,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAQzC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1D,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAMvB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;CAGrE"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.StateManager = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const paths_js_1 = require("../storage/paths.js");
|
|
40
|
+
class StateManager {
|
|
41
|
+
stateFile;
|
|
42
|
+
constructor(pathOptions = {}) {
|
|
43
|
+
this.stateFile = (0, paths_js_1.resolveCliPaths)(pathOptions).stateFile;
|
|
44
|
+
}
|
|
45
|
+
async save(state) {
|
|
46
|
+
const dir = path.dirname(this.stateFile);
|
|
47
|
+
if (!fs.existsSync(dir)) {
|
|
48
|
+
fs.mkdirSync(dir, { mode: 0o700, recursive: true });
|
|
49
|
+
}
|
|
50
|
+
fs.writeFileSync(this.stateFile, JSON.stringify(state, null, 2), { mode: 0o600 });
|
|
51
|
+
}
|
|
52
|
+
async load() {
|
|
53
|
+
if (!fs.existsSync(this.stateFile)) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const raw = fs.readFileSync(this.stateFile, 'utf8');
|
|
57
|
+
return JSON.parse(raw);
|
|
58
|
+
}
|
|
59
|
+
async update(updates) {
|
|
60
|
+
const current = await this.load();
|
|
61
|
+
if (!current) {
|
|
62
|
+
throw new Error('No installation state found');
|
|
63
|
+
}
|
|
64
|
+
await this.save({ ...current, ...updates });
|
|
65
|
+
}
|
|
66
|
+
async delete() {
|
|
67
|
+
if (fs.existsSync(this.stateFile)) {
|
|
68
|
+
fs.unlinkSync(this.stateFile);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async validateInstallDir(state) {
|
|
72
|
+
return fs.existsSync(state.installDir);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.StateManager = StateManager;
|
|
76
|
+
//# sourceMappingURL=state-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-manager.js","sourceRoot":"","sources":["../../src/managers/state-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,kDAAsE;AAkBtE,MAAa,YAAY;IACN,SAAS,CAAS;IAEnC,YAAY,cAA8B,EAAE;QAC1C,IAAI,CAAC,SAAS,GAAG,IAAA,0BAAe,EAAC,WAAW,CAAC,CAAC,SAAS,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAwB;QACjC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACxB,EAAE,CAAC,SAAS,CAAC,GAAG,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ward slashes on all platforms.
|
|
3
|
+
* Handles UNC paths (\\server\share) by preserving the leading double slash.
|
|
4
|
+
*/
|
|
5
|
+
export declare function normalizePath(p: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Detects the current platform.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getPlatform(): 'linux' | 'macos' | 'windows';
|
|
10
|
+
/**
|
|
11
|
+
* Returns the CIG config directory for the current platform.
|
|
12
|
+
* - Linux/macOS: ~/.cig
|
|
13
|
+
* - Windows: %APPDATA%\cig
|
|
14
|
+
*/
|
|
15
|
+
export declare function getConfigDir(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Detects if running inside WSL2 (Windows Subsystem for Linux).
|
|
18
|
+
*/
|
|
19
|
+
export declare function isWSL(): boolean;
|
|
20
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAM/C;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,OAAO,GAAG,OAAO,GAAG,SAAS,CAK3D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAMrC;AAED;;GAEG;AACH,wBAAgB,KAAK,IAAI,OAAO,CAW/B"}
|
package/dist/platform.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.normalizePath = normalizePath;
|
|
37
|
+
exports.getPlatform = getPlatform;
|
|
38
|
+
exports.getConfigDir = getConfigDir;
|
|
39
|
+
exports.isWSL = isWSL;
|
|
40
|
+
const os = __importStar(require("os"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
/**
|
|
44
|
+
* Normalizes path separators to forward slashes on all platforms.
|
|
45
|
+
* Handles UNC paths (\\server\share) by preserving the leading double slash.
|
|
46
|
+
*/
|
|
47
|
+
function normalizePath(p) {
|
|
48
|
+
// Handle UNC paths: \\server\share -> //server/share
|
|
49
|
+
if (p.startsWith('\\\\')) {
|
|
50
|
+
return '//' + p.slice(2).split('\\').join('/');
|
|
51
|
+
}
|
|
52
|
+
return p.split('\\').join('/');
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Detects the current platform.
|
|
56
|
+
*/
|
|
57
|
+
function getPlatform() {
|
|
58
|
+
const platform = os.platform();
|
|
59
|
+
if (platform === 'darwin')
|
|
60
|
+
return 'macos';
|
|
61
|
+
if (platform === 'win32')
|
|
62
|
+
return 'windows';
|
|
63
|
+
return 'linux';
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Returns the CIG config directory for the current platform.
|
|
67
|
+
* - Linux/macOS: ~/.cig
|
|
68
|
+
* - Windows: %APPDATA%\cig
|
|
69
|
+
*/
|
|
70
|
+
function getConfigDir() {
|
|
71
|
+
if (getPlatform() === 'windows') {
|
|
72
|
+
const appData = process.env['APPDATA'] || path.join(os.homedir(), 'AppData', 'Roaming');
|
|
73
|
+
return path.join(appData, 'cig');
|
|
74
|
+
}
|
|
75
|
+
return path.join(os.homedir(), '.cig');
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Detects if running inside WSL2 (Windows Subsystem for Linux).
|
|
79
|
+
*/
|
|
80
|
+
function isWSL() {
|
|
81
|
+
if (os.platform() !== 'linux')
|
|
82
|
+
return false;
|
|
83
|
+
try {
|
|
84
|
+
const release = os.release().toLowerCase();
|
|
85
|
+
if (release.includes('microsoft') || release.includes('wsl'))
|
|
86
|
+
return true;
|
|
87
|
+
// Check /proc/version as a fallback
|
|
88
|
+
const procVersion = fs.readFileSync('/proc/version', 'utf8').toLowerCase();
|
|
89
|
+
return procVersion.includes('microsoft') || procVersion.includes('wsl');
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts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AAE,OAAO,KAAK,CAAC;IAC5C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,WAAW,EAAE,CAAC;QAC3C,IAAI,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAC1E,oCAAoC;QACpC,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;QAC3E,OAAO,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prerequisite Checks for CIG Installation
|
|
3
|
+
*
|
|
4
|
+
* Validates system requirements:
|
|
5
|
+
* - Docker Engine installed and daemon running
|
|
6
|
+
* - Docker Compose v2.0 or later
|
|
7
|
+
* - At least 4 GB free memory
|
|
8
|
+
* - At least 10 GB free disk space
|
|
9
|
+
* - Required ports available (3000, 7474, 7687, 8000, 8080)
|
|
10
|
+
*
|
|
11
|
+
* Requirement 7: CLI Install Flow (Prerequisite Checks)
|
|
12
|
+
*/
|
|
13
|
+
export interface PrereqCheckResult {
|
|
14
|
+
passed: boolean;
|
|
15
|
+
message: string;
|
|
16
|
+
remediation?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function setFreeMemProvider(provider: () => number): void;
|
|
19
|
+
export declare function resetFreeMemProvider(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Check if Docker Engine is installed and the daemon is running.
|
|
22
|
+
* Runs `docker ps` to verify both installation and daemon status.
|
|
23
|
+
*/
|
|
24
|
+
export declare function checkDockerEngine(): Promise<PrereqCheckResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Check if Docker Compose v2.0 or later is available.
|
|
27
|
+
* Runs `docker compose version` and parses the version.
|
|
28
|
+
*/
|
|
29
|
+
export declare function checkDockerCompose(): Promise<PrereqCheckResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Check if at least 4 GB of free memory is available.
|
|
32
|
+
* Uses getFreeMem() to get the system free memory in bytes.
|
|
33
|
+
*/
|
|
34
|
+
export declare function checkMemory(): Promise<PrereqCheckResult>;
|
|
35
|
+
/**
|
|
36
|
+
* Check if at least 10 GB of free disk space is available in the home directory.
|
|
37
|
+
* Uses `df` command to check disk space.
|
|
38
|
+
*/
|
|
39
|
+
export declare function checkDiskSpace(): Promise<PrereqCheckResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Check if required ports (3000, 7474, 7687, 8000, 8080) are available.
|
|
42
|
+
*/
|
|
43
|
+
export declare function checkPorts(): Promise<PrereqCheckResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Run all prerequisite checks and return results.
|
|
46
|
+
*/
|
|
47
|
+
export declare function runAllChecks(): Promise<PrereqCheckResult[]>;
|
|
48
|
+
//# sourceMappingURL=prereqs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prereqs.d.ts","sourceRoot":"","sources":["../src/prereqs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAKD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,MAAM,GAAG,IAAI,CAE/D;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAepE;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAmCrE;AAED;;;GAGG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAiB9D;AAED;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAsCjE;AAoBD;;GAEG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAuB7D;AAED;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CASjE"}
|