@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.
@@ -6,7 +6,7 @@ import {
6
6
  IXORA_DIR,
7
7
  SYSTEMS_CONFIG,
8
8
  readSystems
9
- } from "./chunk-WF33SPL6.js";
9
+ } from "./chunk-KFC4SP2O.js";
10
10
 
11
11
  // src/lib/compose.ts
12
12
  import { execa as execa2 } from "execa";
@@ -2,18 +2,36 @@
2
2
 
3
3
  // src/lib/systems.ts
4
4
  import {
5
- readFileSync as readFileSync2,
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 dirname2 } from "path";
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
- var SCRIPT_VERSION = "0.1.3";
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 = readFileSync(envFile, "utf-8");
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(dirname(envFile), { recursive: true });
173
+ mkdirSync(dirname2(envFile), { recursive: true });
156
174
  let extra = "";
157
175
  let prevVersionLine = "";
158
176
  if (existsSync(envFile)) {
159
- const existing = readFileSync(envFile, "utf-8");
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 = readFileSync(envFile, "utf-8");
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 = readFileSync(envFile, "utf-8");
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(dirname(envFile), { recursive: true });
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 = readFileSync2(configFile, "utf-8");
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(dirname2(configFile), { recursive: true });
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 = readFileSync2(configFile, "utf-8");
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 = readFileSync2(configFile, "utf-8");
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 = readFileSync2(envFile, "utf-8");
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-6FUV5CEK.js";
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-WF33SPL6.js";
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-CU5LAQOY.js");
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-YKLSM7VV.js");
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")}`);
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  cmdRestart
4
- } from "./chunk-6FUV5CEK.js";
5
- import "./chunk-WF33SPL6.js";
4
+ } from "./chunk-K2GF2QLM.js";
5
+ import "./chunk-KFC4SP2O.js";
6
6
  export {
7
7
  cmdRestart
8
8
  };
@@ -6,7 +6,7 @@ import {
6
6
  systemCount,
7
7
  systemIdExists,
8
8
  totalSystemCount
9
- } from "./chunk-WF33SPL6.js";
9
+ } from "./chunk-KFC4SP2O.js";
10
10
  export {
11
11
  addSystem,
12
12
  readSystems,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibm/ixora",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "CLI for managing ixora AI agent deployments on IBM i",
5
5
  "type": "module",
6
6
  "bin": {