openmates 0.11.0-alpha.13 → 0.11.0-alpha.14

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.
@@ -6174,7 +6174,7 @@ function formatTs(ts) {
6174
6174
 
6175
6175
  // src/server.ts
6176
6176
  import { execSync, spawn as nodeSpawn } from "child_process";
6177
- import { copyFileSync, existsSync as existsSync5, readFileSync as readFileSync5, rmSync as rmSync3 } from "fs";
6177
+ import { copyFileSync, existsSync as existsSync5, readFileSync as readFileSync5, rmSync as rmSync3, writeFileSync as writeFileSync3 } from "fs";
6178
6178
  import { createInterface as createInterface2 } from "readline";
6179
6179
  import { homedir as homedir5 } from "os";
6180
6180
  import { join as join3, resolve as resolve3 } from "path";
@@ -6272,6 +6272,21 @@ function composeArgs(installPath, withOverrides) {
6272
6272
  }
6273
6273
  return args;
6274
6274
  }
6275
+ function ensureGitWorkDirEnv(installPath) {
6276
+ const envPath = join3(installPath, ".env");
6277
+ if (!existsSync5(envPath)) return;
6278
+ const content = readFileSync5(envPath, "utf-8");
6279
+ const lineRegex = /^GIT_WORK_DIR=.*$/m;
6280
+ const value = `GIT_WORK_DIR=${installPath}`;
6281
+ if (lineRegex.test(content)) {
6282
+ const next = content.replace(lineRegex, value);
6283
+ if (next !== content) writeFileSync3(envPath, next);
6284
+ return;
6285
+ }
6286
+ const separator = content.endsWith("\n") ? "" : "\n";
6287
+ writeFileSync3(envPath, `${content}${separator}${value}
6288
+ `);
6289
+ }
6275
6290
  function requireDocker() {
6276
6291
  try {
6277
6292
  execSync("docker version", { stdio: "pipe" });
@@ -6344,6 +6359,7 @@ function printJson(data) {
6344
6359
  async function serverStatus(flags) {
6345
6360
  requireDocker();
6346
6361
  const installPath = resolveServerPath(flags);
6362
+ ensureGitWorkDirEnv(installPath);
6347
6363
  const config = loadServerConfig();
6348
6364
  const withOverrides = config?.composeProfile === "full";
6349
6365
  const args = [...composeArgs(installPath, withOverrides), "ps"];
@@ -6356,6 +6372,7 @@ async function serverStatus(flags) {
6356
6372
  async function serverStart(flags) {
6357
6373
  requireDocker();
6358
6374
  const installPath = resolveServerPath(flags);
6375
+ ensureGitWorkDirEnv(installPath);
6359
6376
  warnIfMissingLlmCredentials(installPath);
6360
6377
  const withOverrides = flags["with-overrides"] === true;
6361
6378
  const args = [...composeArgs(installPath, withOverrides), "up", "-d"];
@@ -6381,6 +6398,7 @@ async function serverStart(flags) {
6381
6398
  async function serverStop(flags) {
6382
6399
  requireDocker();
6383
6400
  const installPath = resolveServerPath(flags);
6401
+ ensureGitWorkDirEnv(installPath);
6384
6402
  const config = loadServerConfig();
6385
6403
  const withOverrides = config?.composeProfile === "full";
6386
6404
  const args = [...composeArgs(installPath, withOverrides), "down"];
@@ -6396,6 +6414,7 @@ async function serverStop(flags) {
6396
6414
  async function serverRestart(flags) {
6397
6415
  requireDocker();
6398
6416
  const installPath = resolveServerPath(flags);
6417
+ ensureGitWorkDirEnv(installPath);
6399
6418
  const config = loadServerConfig();
6400
6419
  const withOverrides = config?.composeProfile === "full";
6401
6420
  if (flags.rebuild === true) {
@@ -6428,6 +6447,7 @@ async function serverRestart(flags) {
6428
6447
  async function serverLogs(flags) {
6429
6448
  requireDocker();
6430
6449
  const installPath = resolveServerPath(flags);
6450
+ ensureGitWorkDirEnv(installPath);
6431
6451
  const config = loadServerConfig();
6432
6452
  const withOverrides = config?.composeProfile === "full";
6433
6453
  const args = [...composeArgs(installPath, withOverrides), "logs"];
@@ -6514,6 +6534,7 @@ async function serverUpdate(flags) {
6514
6534
  requireGit();
6515
6535
  requireDocker();
6516
6536
  const installPath = resolveServerPath(flags);
6537
+ ensureGitWorkDirEnv(installPath);
6517
6538
  console.error("Updating OpenMates...");
6518
6539
  if (flags.force === true) {
6519
6540
  console.error("Stashing local changes...");
@@ -6560,6 +6581,7 @@ async function serverUpdate(flags) {
6560
6581
  async function serverReset(flags) {
6561
6582
  requireDocker();
6562
6583
  const installPath = resolveServerPath(flags);
6584
+ ensureGitWorkDirEnv(installPath);
6563
6585
  const config = loadServerConfig();
6564
6586
  const withOverrides = config?.composeProfile === "full";
6565
6587
  const userDataOnly = flags["delete-user-data-only"] === true;
@@ -6640,6 +6662,7 @@ async function serverMakeAdmin(rest, flags) {
6640
6662
  async function serverUninstall(flags) {
6641
6663
  requireDocker();
6642
6664
  const installPath = resolveServerPath(flags);
6665
+ ensureGitWorkDirEnv(installPath);
6643
6666
  const config = loadServerConfig();
6644
6667
  const withOverrides = config?.composeProfile === "full";
6645
6668
  const keepData = flags["keep-data"] === true;
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  getExtForLang,
4
4
  serializeToYaml
5
- } from "./chunk-NS4C7FTB.js";
5
+ } from "./chunk-NQ3NCRIL.js";
6
6
  import "./chunk-SFTCIVE2.js";
7
7
  export {
8
8
  getExtForLang,
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  getExtForLang,
8
8
  parseNewChatSuggestionText,
9
9
  serializeToYaml
10
- } from "./chunk-NS4C7FTB.js";
10
+ } from "./chunk-NQ3NCRIL.js";
11
11
  import "./chunk-SFTCIVE2.js";
12
12
  export {
13
13
  MATE_NAMES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmates",
3
- "version": "0.11.0-alpha.13",
3
+ "version": "0.11.0-alpha.14",
4
4
  "description": "OpenMates CLI and SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",