@dench.com/cli 3.6.0 → 3.6.1-staging.362

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/dench.ts CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  stat,
11
11
  writeFile,
12
12
  } from "node:fs/promises";
13
- import { homedir, hostname, userInfo } from "node:os";
13
+ import { hostname, userInfo } from "node:os";
14
14
  import { basename, dirname, join, relative, resolve } from "node:path";
15
15
  import { fileURLToPath } from "node:url";
16
16
  import { ConvexHttpClient } from "convex/browser";
@@ -29,6 +29,7 @@ import {
29
29
  STAGING_HOST,
30
30
  } from "./host";
31
31
  import { cliVersion } from "./lib/cli-version";
32
+ import { denchConfigDirectory } from "./lib/config-path.mjs";
32
33
  import { resolveOrganizationBySelector } from "./lib/organizationSelector";
33
34
  import { backendErrorText } from "./lib/public-error";
34
35
  import { normalizeUnipileToolkitSlug } from "./lib/unipile-toolkits";
@@ -210,7 +211,7 @@ const api = {
210
211
  },
211
212
  },
212
213
  };
213
- const CONFIG_DIR = join(homedir(), ".dench");
214
+ const CONFIG_DIR = denchConfigDirectory();
214
215
  const CONFIG_PATH = join(CONFIG_DIR, "config.json");
215
216
  const args = process.argv.slice(2);
216
217
  const json = args.includes("--json");
@@ -0,0 +1,8 @@
1
+ import { homedir } from "node:os";
2
+ import { join, resolve } from "node:path";
3
+
4
+ /** Explicit CLI state isolation for managed agents; never changes the OS home. */
5
+ export function denchConfigDirectory(env = process.env) {
6
+ const configured = env.DENCH_CONFIG_DIR?.trim();
7
+ return configured ? resolve(configured) : join(homedir(), ".dench");
8
+ }
@@ -35,13 +35,12 @@
35
35
  // disabled.
36
36
 
37
37
  import { existsSync, readFileSync } from "node:fs";
38
- import { homedir } from "node:os";
39
38
  import { dirname, join } from "node:path";
40
39
  import { fileURLToPath } from "node:url";
40
+ import { denchConfigDirectory } from "./config-path.mjs";
41
41
 
42
42
  const WORKSPACE_PACKAGE_NAME = "ironclaw-cloud";
43
43
  const ENV_FILES = [".env", ".env.local"];
44
- const CONFIG_PATH = join(homedir(), ".dench", "config.json");
45
44
 
46
45
  const TRUE_ENV_VALUES = new Set(["1", "true", "yes", "on"]);
47
46
 
@@ -55,8 +54,9 @@ function argvOptIn(argv) {
55
54
  return argv.includes("--dev") || argv.includes("--use-dev-env");
56
55
  }
57
56
 
58
- function configOptIn() {
57
+ function configOptIn(env) {
59
58
  try {
59
+ const CONFIG_PATH = join(denchConfigDirectory(env), "config.json");
60
60
  if (!existsSync(CONFIG_PATH)) return false;
61
61
  const raw = readFileSync(CONFIG_PATH, "utf8");
62
62
  const config = JSON.parse(raw);
@@ -70,7 +70,9 @@ function configOptIn() {
70
70
 
71
71
  function isLocalUrl(value) {
72
72
  try {
73
- const url = new URL(/^https?:\/\//.test(value) ? value : `https://${value}`);
73
+ const url = new URL(
74
+ /^https?:\/\//.test(value) ? value : `https://${value}`,
75
+ );
74
76
  const host = url.hostname;
75
77
  return (
76
78
  host === "localhost" ||
@@ -90,7 +92,7 @@ export function shouldLoadDevEnv({
90
92
  } = {}) {
91
93
  if (envFlagEnabled(env.DENCH_USE_DEV_ENV)) return "env";
92
94
  if (argvOptIn(argv)) return "argv";
93
- if (configOptIn()) return "config";
95
+ if (configOptIn(env)) return "config";
94
96
  return false;
95
97
  }
96
98
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dench.com/cli",
3
- "version": "3.6.0",
3
+ "version": "3.6.1-staging.362",
4
4
  "description": "Dench agent workspace CLI.",
5
5
  "type": "module",
6
6
  "bin": {