@ibm/ixora 0.1.4 → 0.1.5
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/dist/{chunk-6FUV5CEK.js → chunk-K2GF2QLM.js} +1 -1
- package/dist/{chunk-WF33SPL6.js → chunk-KFC4SP2O.js} +35 -17
- package/dist/index.js +4 -4
- package/dist/{restart-YKLSM7VV.js → restart-VIVFUUQG.js} +2 -2
- package/dist/{systems-CU5LAQOY.js → systems-JHJ3CQRN.js} +1 -1
- package/package.json +1 -1
|
@@ -2,18 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
// src/lib/systems.ts
|
|
4
4
|
import {
|
|
5
|
-
readFileSync as
|
|
5
|
+
readFileSync as readFileSync3,
|
|
6
6
|
writeFileSync as writeFileSync2,
|
|
7
7
|
existsSync as existsSync2,
|
|
8
8
|
mkdirSync as mkdirSync2,
|
|
9
9
|
chmodSync as chmodSync2
|
|
10
10
|
} from "fs";
|
|
11
|
-
import { dirname as
|
|
11
|
+
import { dirname as dirname3 } from "path";
|
|
12
12
|
|
|
13
13
|
// src/lib/constants.ts
|
|
14
|
+
import { readFileSync } from "fs";
|
|
14
15
|
import { homedir } from "os";
|
|
15
|
-
import { join } from "path";
|
|
16
|
-
|
|
16
|
+
import { dirname, join } from "path";
|
|
17
|
+
import { fileURLToPath } from "url";
|
|
18
|
+
function readCliVersion() {
|
|
19
|
+
let dir = dirname(fileURLToPath(import.meta.url));
|
|
20
|
+
for (let i = 0; i < 5; i++) {
|
|
21
|
+
try {
|
|
22
|
+
const pkg = JSON.parse(
|
|
23
|
+
readFileSync(join(dir, "package.json"), "utf8")
|
|
24
|
+
);
|
|
25
|
+
if (pkg.name === "@ibm/ixora" && pkg.version) return pkg.version;
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
const parent = dirname(dir);
|
|
29
|
+
if (parent === dir) break;
|
|
30
|
+
dir = parent;
|
|
31
|
+
}
|
|
32
|
+
return "unknown";
|
|
33
|
+
}
|
|
34
|
+
var SCRIPT_VERSION = readCliVersion();
|
|
17
35
|
var HEALTH_TIMEOUT = 30;
|
|
18
36
|
var IXORA_DIR = join(homedir(), ".ixora");
|
|
19
37
|
var COMPOSE_FILE = join(IXORA_DIR, "docker-compose.yml");
|
|
@@ -112,19 +130,19 @@ var AGENT_PRESETS = {
|
|
|
112
130
|
|
|
113
131
|
// src/lib/env.ts
|
|
114
132
|
import {
|
|
115
|
-
readFileSync,
|
|
133
|
+
readFileSync as readFileSync2,
|
|
116
134
|
writeFileSync,
|
|
117
135
|
existsSync,
|
|
118
136
|
mkdirSync,
|
|
119
137
|
chmodSync
|
|
120
138
|
} from "fs";
|
|
121
|
-
import { dirname } from "path";
|
|
139
|
+
import { dirname as dirname2 } from "path";
|
|
122
140
|
function sqEscape(value) {
|
|
123
141
|
return value.replace(/'/g, "'\\''");
|
|
124
142
|
}
|
|
125
143
|
function envGet(key, envFile = ENV_FILE) {
|
|
126
144
|
if (!existsSync(envFile)) return "";
|
|
127
|
-
const content =
|
|
145
|
+
const content = readFileSync2(envFile, "utf-8");
|
|
128
146
|
for (const line of content.split("\n")) {
|
|
129
147
|
if (line.startsWith(`${key}=`)) {
|
|
130
148
|
let val = line.slice(key.length + 1);
|
|
@@ -152,11 +170,11 @@ var KNOWN_KEYS = [
|
|
|
152
170
|
"IXORA_TEAM_MODEL"
|
|
153
171
|
];
|
|
154
172
|
function writeEnvFile(config, envFile = ENV_FILE) {
|
|
155
|
-
mkdirSync(
|
|
173
|
+
mkdirSync(dirname2(envFile), { recursive: true });
|
|
156
174
|
let extra = "";
|
|
157
175
|
let prevVersionLine = "";
|
|
158
176
|
if (existsSync(envFile)) {
|
|
159
|
-
const existing =
|
|
177
|
+
const existing = readFileSync2(envFile, "utf-8");
|
|
160
178
|
const lines = existing.split("\n");
|
|
161
179
|
const extraLines = lines.filter((line) => {
|
|
162
180
|
const trimmed = line.trim();
|
|
@@ -209,7 +227,7 @@ ${extra}
|
|
|
209
227
|
function updateEnvKey(key, value, envFile = ENV_FILE) {
|
|
210
228
|
const escaped = sqEscape(value);
|
|
211
229
|
if (existsSync(envFile)) {
|
|
212
|
-
const content =
|
|
230
|
+
const content = readFileSync2(envFile, "utf-8");
|
|
213
231
|
const lines = content.split("\n");
|
|
214
232
|
let found = false;
|
|
215
233
|
const updated = lines.map((line) => {
|
|
@@ -222,7 +240,7 @@ function updateEnvKey(key, value, envFile = ENV_FILE) {
|
|
|
222
240
|
if (found) {
|
|
223
241
|
writeFileSync(envFile, updated.join("\n"), "utf-8");
|
|
224
242
|
} else {
|
|
225
|
-
const existing =
|
|
243
|
+
const existing = readFileSync2(envFile, "utf-8");
|
|
226
244
|
const suffix = existing.endsWith("\n") ? "" : "\n";
|
|
227
245
|
writeFileSync(
|
|
228
246
|
envFile,
|
|
@@ -232,7 +250,7 @@ function updateEnvKey(key, value, envFile = ENV_FILE) {
|
|
|
232
250
|
);
|
|
233
251
|
}
|
|
234
252
|
} else {
|
|
235
|
-
mkdirSync(
|
|
253
|
+
mkdirSync(dirname2(envFile), { recursive: true });
|
|
236
254
|
writeFileSync(envFile, `${key}='${escaped}'
|
|
237
255
|
`, "utf-8");
|
|
238
256
|
}
|
|
@@ -242,7 +260,7 @@ function updateEnvKey(key, value, envFile = ENV_FILE) {
|
|
|
242
260
|
// src/lib/systems.ts
|
|
243
261
|
function readSystems(configFile = SYSTEMS_CONFIG) {
|
|
244
262
|
if (!existsSync2(configFile)) return [];
|
|
245
|
-
const content =
|
|
263
|
+
const content = readFileSync3(configFile, "utf-8");
|
|
246
264
|
const systems = [];
|
|
247
265
|
let current = null;
|
|
248
266
|
for (const line of content.split("\n")) {
|
|
@@ -308,7 +326,7 @@ function addSystem(system, envFile = ENV_FILE, configFile = SYSTEMS_CONFIG) {
|
|
|
308
326
|
profile: ${profile}
|
|
309
327
|
agents: [${agentsList}]
|
|
310
328
|
`;
|
|
311
|
-
mkdirSync2(
|
|
329
|
+
mkdirSync2(dirname3(configFile), { recursive: true });
|
|
312
330
|
if (!existsSync2(configFile) || systemCount(configFile) === 0) {
|
|
313
331
|
const content = `# yaml-language-server: $schema=
|
|
314
332
|
# Ixora Systems Configuration
|
|
@@ -318,7 +336,7 @@ systems:
|
|
|
318
336
|
${entry}`;
|
|
319
337
|
writeFileSync2(configFile, content, "utf-8");
|
|
320
338
|
} else {
|
|
321
|
-
const existing =
|
|
339
|
+
const existing = readFileSync3(configFile, "utf-8");
|
|
322
340
|
writeFileSync2(configFile, `${existing}${entry}`, "utf-8");
|
|
323
341
|
}
|
|
324
342
|
chmodSync2(configFile, 384);
|
|
@@ -330,7 +348,7 @@ function removeSystem(id, envFile = ENV_FILE, configFile = SYSTEMS_CONFIG) {
|
|
|
330
348
|
if (!systemIdExists(id, configFile)) {
|
|
331
349
|
throw new Error(`System '${id}' not found`);
|
|
332
350
|
}
|
|
333
|
-
const content =
|
|
351
|
+
const content = readFileSync3(configFile, "utf-8");
|
|
334
352
|
const lines = content.split("\n");
|
|
335
353
|
const output = [];
|
|
336
354
|
let skip = false;
|
|
@@ -350,7 +368,7 @@ function removeSystem(id, envFile = ENV_FILE, configFile = SYSTEMS_CONFIG) {
|
|
|
350
368
|
chmodSync2(configFile, 384);
|
|
351
369
|
if (existsSync2(envFile)) {
|
|
352
370
|
const idUpper = id.toUpperCase().replace(/-/g, "_");
|
|
353
|
-
const envContent =
|
|
371
|
+
const envContent = readFileSync3(envFile, "utf-8");
|
|
354
372
|
const filtered = envContent.split("\n").filter((line) => !line.startsWith(`SYSTEM_${idUpper}_`)).join("\n");
|
|
355
373
|
writeFileSync2(envFile, filtered, "utf-8");
|
|
356
374
|
chmodSync2(envFile, 384);
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
waitForHealthy,
|
|
23
23
|
warn,
|
|
24
24
|
writeComposeFile
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-K2GF2QLM.js";
|
|
26
26
|
import {
|
|
27
27
|
COMPOSE_FILE,
|
|
28
28
|
ENV_FILE,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
systemIdExists,
|
|
40
40
|
updateEnvKey,
|
|
41
41
|
writeEnvFile
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-KFC4SP2O.js";
|
|
43
43
|
|
|
44
44
|
// src/cli.ts
|
|
45
45
|
import { Command } from "commander";
|
|
@@ -728,7 +728,7 @@ async function cmdInstall(opts) {
|
|
|
728
728
|
writeEnvFile(envConfig);
|
|
729
729
|
success("Wrote .env");
|
|
730
730
|
if (systemIdExists("default")) {
|
|
731
|
-
const { removeSystem: removeSystem2 } = await import("./systems-
|
|
731
|
+
const { removeSystem: removeSystem2 } = await import("./systems-JHJ3CQRN.js");
|
|
732
732
|
removeSystem2("default");
|
|
733
733
|
}
|
|
734
734
|
addSystem({
|
|
@@ -956,7 +956,7 @@ async function cmdSystemAdd() {
|
|
|
956
956
|
default: true
|
|
957
957
|
});
|
|
958
958
|
if (shouldRestart) {
|
|
959
|
-
const { cmdRestart: cmdRestart2 } = await import("./restart-
|
|
959
|
+
const { cmdRestart: cmdRestart2 } = await import("./restart-VIVFUUQG.js");
|
|
960
960
|
await cmdRestart2({});
|
|
961
961
|
} else {
|
|
962
962
|
console.log(` Restart to apply: ${bold("ixora restart")}`);
|