@happier-dev/stack 0.2.0 → 0.2.1-preview.1775586714.26562
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/node_modules/@happier-dev/agents/dist/.tsbuildinfo +1 -1
- package/node_modules/@happier-dev/agents/dist/index.d.ts +1 -1
- package/node_modules/@happier-dev/agents/dist/index.d.ts.map +1 -1
- package/node_modules/@happier-dev/agents/dist/index.js.map +1 -1
- package/node_modules/@happier-dev/agents/dist/providerSettings/definitions/claudeRemote.d.ts +9 -9
- package/node_modules/@happier-dev/agents/dist/providerSettings/definitions/codex.d.ts +5 -5
- package/node_modules/@happier-dev/agents/dist/providers/providerCliRuntime.d.ts +14 -1
- package/node_modules/@happier-dev/agents/dist/providers/providerCliRuntime.d.ts.map +1 -1
- package/node_modules/@happier-dev/agents/dist/providers/providerCliRuntime.js +25 -12
- package/node_modules/@happier-dev/agents/dist/providers/providerCliRuntime.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/.tsbuildinfo +1 -1
- package/node_modules/@happier-dev/cli-common/dist/componentArtifacts/buildCliBinaryArtifactPayload.js +1 -1
- package/node_modules/@happier-dev/cli-common/dist/componentArtifacts/buildCliBinaryArtifactPayload.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/componentArtifacts/commands.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/componentArtifacts/commands.js +2 -1
- package/node_modules/@happier-dev/cli-common/dist/componentArtifacts/commands.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/componentArtifacts/commands.test.js +22 -0
- package/node_modules/@happier-dev/cli-common/dist/componentArtifacts/commands.test.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/index.d.ts +2 -2
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/index.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/index.js +1 -1
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/index.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/relayRuntime.d.ts +12 -0
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/relayRuntime.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/relayRuntime.js +18 -0
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/relayRuntime.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/relayRuntime.test.js +39 -0
- package/node_modules/@happier-dev/cli-common/dist/firstPartyRuntime/relayRuntime.test.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/process/index.d.ts +1 -1
- package/node_modules/@happier-dev/cli-common/dist/process/index.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/process/index.js +1 -1
- package/node_modules/@happier-dev/cli-common/dist/process/index.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/process/windows/resolveWindowsCommandInvocation.d.ts +1 -0
- package/node_modules/@happier-dev/cli-common/dist/process/windows/resolveWindowsCommandInvocation.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/process/windows/resolveWindowsCommandInvocation.js +23 -5
- package/node_modules/@happier-dev/cli-common/dist/process/windows/resolveWindowsCommandInvocation.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/process/windows/resolveWindowsCommandInvocation.test.d.ts +2 -0
- package/node_modules/@happier-dev/cli-common/dist/process/windows/resolveWindowsCommandInvocation.test.d.ts.map +1 -0
- package/node_modules/@happier-dev/cli-common/dist/process/windows/resolveWindowsCommandInvocation.test.js +64 -0
- package/node_modules/@happier-dev/cli-common/dist/process/windows/resolveWindowsCommandInvocation.test.js.map +1 -0
- package/node_modules/@happier-dev/cli-common/dist/providers/index.d.ts +1 -1
- package/node_modules/@happier-dev/cli-common/dist/providers/index.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/providers/index.js +1 -1
- package/node_modules/@happier-dev/cli-common/dist/providers/index.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/providers/install.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/providers/install.js +3 -1
- package/node_modules/@happier-dev/cli-common/dist/providers/install.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/providers/managedJavaScriptRuntime.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/providers/managedJavaScriptRuntime.js +10 -1
- package/node_modules/@happier-dev/cli-common/dist/providers/managedJavaScriptRuntime.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/providers/managedJavaScriptRuntime.systemNodeFallback.test.js +58 -1
- package/node_modules/@happier-dev/cli-common/dist/providers/managedJavaScriptRuntime.systemNodeFallback.test.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/providers/resolution.d.ts +2 -0
- package/node_modules/@happier-dev/cli-common/dist/providers/resolution.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/providers/resolution.js +120 -32
- package/node_modules/@happier-dev/cli-common/dist/providers/resolution.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/providers/resolveHappyHomeDir.d.ts.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/providers/resolveHappyHomeDir.js +10 -1
- package/node_modules/@happier-dev/cli-common/dist/providers/resolveHappyHomeDir.js.map +1 -1
- package/node_modules/@happier-dev/cli-common/dist/providers/resolveHappyHomeDir.test.js +6 -0
- package/node_modules/@happier-dev/cli-common/dist/providers/resolveHappyHomeDir.test.js.map +1 -1
- package/node_modules/@happier-dev/protocol/dist/.tsbuildinfo +1 -1
- package/node_modules/@happier-dev/protocol/dist/e2e/providerSpec.d.ts +2 -2
- package/node_modules/@happier-dev/protocol/dist/features/decision.d.ts +2 -2
- package/node_modules/@happier-dev/protocol/dist/features/payload/capabilities/authCapabilities.d.ts +1 -1
- package/node_modules/@happier-dev/protocol/dist/features/payload/capabilities/capabilitiesSchema.d.ts +1 -1
- package/node_modules/@happier-dev/protocol/dist/features/payload/featuresResponseSchema.d.ts +1 -1
- package/node_modules/@happier-dev/protocol/dist/structuredMessages/reviewFindingsV1.d.ts +3 -3
- package/node_modules/@happier-dev/protocol/dist/structuredMessages/reviewFindingsV2.d.ts +1 -1
- package/node_modules/@happier-dev/release-runtime/dist/.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/scripts/doctor.mjs +10 -2
- package/scripts/env.mjs +2 -5
- package/scripts/env_cmd.test.mjs +32 -0
- package/scripts/ghops.mjs +7 -4
- package/scripts/ghops.test.mjs +42 -1
- package/scripts/happier.mjs +2 -2
- package/scripts/menubar.mjs +2 -2
- package/scripts/run.mjs +2 -2
- package/scripts/self_host_runtime.mjs +10 -7
- package/scripts/self_host_runtime.test.mjs +47 -0
- package/scripts/service.mjs +10 -3
- package/scripts/stack.mjs +3 -2
- package/scripts/tailscale.mjs +2 -2
- package/scripts/utils/env/config.mjs +2 -7
- package/scripts/utils/env/env.mjs +9 -5
- package/scripts/utils/env/env_local.mjs +2 -1
- package/scripts/utils/paths/canonical_home.mjs +11 -3
- package/scripts/utils/paths/canonical_home.test.mjs +11 -3
- package/scripts/utils/paths/paths.mjs +17 -5
- package/scripts/utils/paths/paths_home_env.test.mjs +43 -0
- package/scripts/utils/proc/pm.mjs +9 -4
- package/scripts/utils/proc/pm_stack_cache_env.test.mjs +28 -0
- package/scripts/utils/review/targets.mjs +2 -2
- package/scripts/utils/server/apply_server_light_env_defaults.mjs +4 -3
- package/scripts/utils/server/apply_server_light_env_defaults.test.mjs +25 -0
- package/scripts/utils/server/urls.mjs +3 -5
- package/scripts/utils/server/urls.test.mjs +22 -1
- package/scripts/utils/service/stack_autostart_resolution.mjs +6 -2
- package/scripts/utils/service/stack_autostart_resolution.test.mjs +13 -1
- package/scripts/utils/stack/context.mjs +2 -3
- package/scripts/utils/stack/context.test.mjs +18 -0
- package/scripts/utils/stack/dirs.mjs +4 -4
- package/scripts/utils/stack/dirs.test.mjs +33 -0
- package/scripts/utils/stack/stop.mjs +2 -2
- package/scripts/where.mjs +15 -4
- package/scripts/worktrees.mjs +2 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import test from 'node:test';
|
|
3
|
+
|
|
4
|
+
import { applyServerLightEnvDefaults } from './apply_server_light_env_defaults.mjs';
|
|
5
|
+
|
|
6
|
+
test('applyServerLightEnvDefaults expands ~/ light-server path overrides against HOME', () => {
|
|
7
|
+
const serverEnv = {};
|
|
8
|
+
|
|
9
|
+
applyServerLightEnvDefaults({
|
|
10
|
+
baseEnv: {
|
|
11
|
+
HOME: '/scoped/home',
|
|
12
|
+
HAPPIER_SERVER_LIGHT_DATA_DIR: '~/server-light',
|
|
13
|
+
HAPPIER_SERVER_LIGHT_FILES_DIR: '~/server-light/files-override',
|
|
14
|
+
HAPPIER_SERVER_LIGHT_DB_DIR: '~/server-light/db-override',
|
|
15
|
+
},
|
|
16
|
+
serverEnv,
|
|
17
|
+
baseDir: '/stack/base',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
assert.deepEqual(serverEnv, {
|
|
21
|
+
HAPPIER_SERVER_LIGHT_DATA_DIR: '/scoped/home/server-light',
|
|
22
|
+
HAPPIER_SERVER_LIGHT_FILES_DIR: '/scoped/home/server-light/files-override',
|
|
23
|
+
HAPPIER_SERVER_LIGHT_DB_DIR: '/scoped/home/server-light/db-override',
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
2
|
|
|
3
|
-
import { getStackName,
|
|
3
|
+
import { getStackName, resolveActiveStackEnvFilePath } from '../paths/paths.mjs';
|
|
4
4
|
import { preferStackLocalhostUrl } from '../paths/localhost_host.mjs';
|
|
5
5
|
import { resolvePublicServerUrl } from '../../tailscale.mjs';
|
|
6
6
|
import { resolveServerPortFromEnv } from './port.mjs';
|
|
@@ -9,8 +9,7 @@ import { normalizeUrlNoTrailingSlash } from '../net/url.mjs';
|
|
|
9
9
|
function stackEnvExplicitlySetsPublicUrl({ env, stackName }) {
|
|
10
10
|
try {
|
|
11
11
|
const envPath =
|
|
12
|
-
(env
|
|
13
|
-
resolveStackEnvPath(stackName).envPath;
|
|
12
|
+
resolveActiveStackEnvFilePath(stackName, env);
|
|
14
13
|
if (!envPath || !existsSync(envPath)) return false;
|
|
15
14
|
const raw = readFileSync(envPath, 'utf-8');
|
|
16
15
|
return /^HAPPIER_PUBLIC_SERVER_URL=/m.test(raw) || /^HAPPIER_STACK_SERVER_URL=/m.test(raw);
|
|
@@ -22,8 +21,7 @@ function stackEnvExplicitlySetsPublicUrl({ env, stackName }) {
|
|
|
22
21
|
function stackEnvExplicitlySetsWebappUrl({ env, stackName }) {
|
|
23
22
|
try {
|
|
24
23
|
const envPath =
|
|
25
|
-
(env
|
|
26
|
-
resolveStackEnvPath(stackName).envPath;
|
|
24
|
+
resolveActiveStackEnvFilePath(stackName, env);
|
|
27
25
|
if (!envPath || !existsSync(envPath)) return false;
|
|
28
26
|
const raw = readFileSync(envPath, 'utf-8');
|
|
29
27
|
return /^HAPPIER_WEBAPP_URL=/m.test(raw);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import test from 'node:test';
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
|
-
import { mkdtemp, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { mkdir, mkdtemp, writeFile } from 'node:fs/promises';
|
|
4
4
|
import { join } from 'node:path';
|
|
5
5
|
import { tmpdir } from 'node:os';
|
|
6
6
|
|
|
@@ -49,3 +49,24 @@ test('getPublicServerUrlEnvOverride falls back to HAPPIER_STACK_SERVER_URL when
|
|
|
49
49
|
assert.equal(out.envPublicUrl, 'https://stack-share.example.test');
|
|
50
50
|
assert.equal(out.publicServerUrl, 'https://stack-share.example.test');
|
|
51
51
|
});
|
|
52
|
+
|
|
53
|
+
test('getPublicServerUrlEnvOverride expands ~/ explicit env file overrides against HOME', async () => {
|
|
54
|
+
const dir = await mkdtemp(join(tmpdir(), 'hstack-server-urls-'));
|
|
55
|
+
const homeDir = join(dir, 'home');
|
|
56
|
+
const envPath = join(homeDir, '.happier', 'stacks', 'dev', 'env');
|
|
57
|
+
await mkdir(join(homeDir, '.happier', 'stacks', 'dev'), { recursive: true });
|
|
58
|
+
await writeFile(envPath, 'HAPPIER_STACK_SERVER_URL=https://stack-share.example.test\n', 'utf-8');
|
|
59
|
+
|
|
60
|
+
const out = getPublicServerUrlEnvOverride({
|
|
61
|
+
env: {
|
|
62
|
+
HOME: homeDir,
|
|
63
|
+
HAPPIER_STACK_STACK: 'dev',
|
|
64
|
+
HAPPIER_STACK_ENV_FILE: '~/.happier/stacks/dev/env',
|
|
65
|
+
HAPPIER_STACK_SERVER_URL: 'https://stack-share.example.test',
|
|
66
|
+
},
|
|
67
|
+
serverPort: 3005,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
assert.equal(out.envPublicUrl, 'https://stack-share.example.test');
|
|
71
|
+
assert.equal(out.publicServerUrl, 'https://stack-share.example.test');
|
|
72
|
+
});
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { basename, join } from 'node:path';
|
|
2
|
+
import { expandHome } from '../paths/canonical_home.mjs';
|
|
2
3
|
|
|
3
4
|
export function resolveAutostartEnvFilePath({
|
|
4
5
|
mode,
|
|
5
6
|
explicitEnvFilePath,
|
|
6
7
|
defaultMainEnvFilePath,
|
|
7
8
|
systemUserHomeDir,
|
|
9
|
+
homeDir,
|
|
8
10
|
} = {}) {
|
|
9
11
|
const explicit = String(explicitEnvFilePath ?? '').trim();
|
|
10
|
-
if (explicit)
|
|
12
|
+
if (explicit) {
|
|
13
|
+
const scopedHomeDir = String(homeDir ?? '').trim();
|
|
14
|
+
return scopedHomeDir ? expandHome(explicit, { HOME: scopedHomeDir, USERPROFILE: scopedHomeDir }) : explicit;
|
|
15
|
+
}
|
|
11
16
|
|
|
12
17
|
const m = String(mode ?? '').trim().toLowerCase() === 'system' ? 'system' : 'user';
|
|
13
18
|
const home = String(systemUserHomeDir ?? '').trim();
|
|
@@ -74,4 +79,3 @@ export function resolveAutostartLogPaths({
|
|
|
74
79
|
stderrPath: String(defaultStderrPath ?? '').trim(),
|
|
75
80
|
};
|
|
76
81
|
}
|
|
77
|
-
|
|
@@ -19,6 +19,19 @@ test('resolveAutostartEnvFilePath prefers explicit HAPPIER_STACK_ENV_FILE overri
|
|
|
19
19
|
);
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
+
test('resolveAutostartEnvFilePath expands ~/ explicit overrides against the provided home dir', () => {
|
|
23
|
+
assert.equal(
|
|
24
|
+
resolveAutostartEnvFilePath({
|
|
25
|
+
mode: 'user',
|
|
26
|
+
explicitEnvFilePath: '~/.happier/stacks/main/env',
|
|
27
|
+
defaultMainEnvFilePath: '/root/.happier/stacks/main/env',
|
|
28
|
+
systemUserHomeDir: '',
|
|
29
|
+
homeDir: '/scoped/home',
|
|
30
|
+
}),
|
|
31
|
+
'/scoped/home/.happier/stacks/main/env'
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
|
|
22
35
|
test('resolveAutostartEnvFilePath uses system user home when installing a system service', () => {
|
|
23
36
|
assert.equal(
|
|
24
37
|
resolveAutostartEnvFilePath({
|
|
@@ -114,4 +127,3 @@ test('resolveAutostartLogPaths uses system user home for system mode when storag
|
|
|
114
127
|
assert.equal(res.stdoutPath, '/home/happier/.happier/stacks/main/logs/happier-stack.out.log');
|
|
115
128
|
assert.equal(res.stderrPath, '/home/happier/.happier/stacks/main/logs/happier-stack.err.log');
|
|
116
129
|
});
|
|
117
|
-
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getStackName,
|
|
1
|
+
import { getStackName, resolveActiveStackEnvFilePath } from '../paths/paths.mjs';
|
|
2
2
|
import { getStackRuntimeStatePath } from './runtime_state.mjs';
|
|
3
3
|
|
|
4
4
|
export function resolveStackContext({ env = process.env, autostart = null } = {}) {
|
|
@@ -6,8 +6,7 @@ export function resolveStackContext({ env = process.env, autostart = null } = {}
|
|
|
6
6
|
const stackName = explicitStack || (autostart?.stackName ?? '') || getStackName(env);
|
|
7
7
|
const stackMode = Boolean(explicitStack);
|
|
8
8
|
|
|
9
|
-
const envPath =
|
|
10
|
-
(env.HAPPIER_STACK_ENV_FILE ?? '').toString().trim() || resolveStackEnvPath(stackName, env).envPath;
|
|
9
|
+
const envPath = resolveActiveStackEnvFilePath(stackName, env);
|
|
11
10
|
|
|
12
11
|
const runtimeStatePath =
|
|
13
12
|
(env.HAPPIER_STACK_RUNTIME_STATE_PATH ?? '').toString().trim() || getStackRuntimeStatePath(stackName);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
|
|
4
|
+
import { resolveStackContext } from './context.mjs';
|
|
5
|
+
|
|
6
|
+
test('resolveStackContext expands ~/ explicit env file overrides against HOME', () => {
|
|
7
|
+
const out = resolveStackContext({
|
|
8
|
+
env: {
|
|
9
|
+
HOME: '/scoped/home',
|
|
10
|
+
HAPPIER_STACK_STACK: 'dev',
|
|
11
|
+
HAPPIER_STACK_ENV_FILE: '~/.happier/stacks/dev/env',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
assert.equal(out.stackMode, true);
|
|
16
|
+
assert.equal(out.stackName, 'dev');
|
|
17
|
+
assert.equal(out.envPath, '/scoped/home/.happier/stacks/dev/env');
|
|
18
|
+
});
|
|
@@ -4,23 +4,23 @@ import { expandHome } from '../paths/canonical_home.mjs';
|
|
|
4
4
|
import { getDefaultAutostartPaths } from '../paths/paths.mjs';
|
|
5
5
|
|
|
6
6
|
export function getCliHomeDirFromEnvOrDefault({ stackBaseDir, env }) {
|
|
7
|
-
const fromEnv = (env?.HAPPIER_STACK_CLI_HOME_DIR ?? '').trim();
|
|
7
|
+
const fromEnv = expandHome((env?.HAPPIER_STACK_CLI_HOME_DIR ?? '').trim(), env);
|
|
8
8
|
return fromEnv || join(stackBaseDir, 'cli');
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export function getServerLightDataDirFromEnvOrDefault({ stackBaseDir, env }) {
|
|
12
|
-
const fromEnv = (env?.HAPPIER_SERVER_LIGHT_DATA_DIR ?? '').trim();
|
|
12
|
+
const fromEnv = expandHome((env?.HAPPIER_SERVER_LIGHT_DATA_DIR ?? '').trim(), env);
|
|
13
13
|
return fromEnv || join(stackBaseDir, 'server-light');
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function resolveCliHomeDir(env = process.env) {
|
|
17
17
|
const fromExplicit = (env.HAPPIER_HOME_DIR ?? '').trim();
|
|
18
18
|
if (fromExplicit) {
|
|
19
|
-
return expandHome(fromExplicit);
|
|
19
|
+
return expandHome(fromExplicit, env);
|
|
20
20
|
}
|
|
21
21
|
const fromStacks = (env.HAPPIER_STACK_CLI_HOME_DIR ?? '').trim();
|
|
22
22
|
if (fromStacks) {
|
|
23
|
-
return expandHome(fromStacks);
|
|
23
|
+
return expandHome(fromStacks, env);
|
|
24
24
|
}
|
|
25
25
|
return join(getDefaultAutostartPaths().baseDir, 'cli');
|
|
26
26
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import test from 'node:test';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
getCliHomeDirFromEnvOrDefault,
|
|
6
|
+
getServerLightDataDirFromEnvOrDefault,
|
|
7
|
+
} from './dirs.mjs';
|
|
8
|
+
|
|
9
|
+
test('getCliHomeDirFromEnvOrDefault expands ~/ overrides against HOME', () => {
|
|
10
|
+
assert.equal(
|
|
11
|
+
getCliHomeDirFromEnvOrDefault({
|
|
12
|
+
stackBaseDir: '/stack/base',
|
|
13
|
+
env: {
|
|
14
|
+
HOME: '/scoped/home',
|
|
15
|
+
HAPPIER_STACK_CLI_HOME_DIR: '~/cli-home',
|
|
16
|
+
},
|
|
17
|
+
}),
|
|
18
|
+
'/scoped/home/cli-home',
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('getServerLightDataDirFromEnvOrDefault expands ~/ overrides against HOME', () => {
|
|
23
|
+
assert.equal(
|
|
24
|
+
getServerLightDataDirFromEnvOrDefault({
|
|
25
|
+
stackBaseDir: '/stack/base',
|
|
26
|
+
env: {
|
|
27
|
+
HOME: '/scoped/home',
|
|
28
|
+
HAPPIER_SERVER_LIGHT_DATA_DIR: '~/server-light',
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
'/scoped/home/server-light',
|
|
32
|
+
);
|
|
33
|
+
});
|
|
@@ -2,7 +2,7 @@ import { existsSync } from 'node:fs';
|
|
|
2
2
|
import { readdir, readFile } from 'node:fs/promises';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
|
|
5
|
-
import { getComponentDir } from '../paths/paths.mjs';
|
|
5
|
+
import { getComponentDir, resolveExplicitStackEnvFilePath } from '../paths/paths.mjs';
|
|
6
6
|
import { isPidAlive, killPid, readPidState } from '../expo/expo.mjs';
|
|
7
7
|
import { stopLocalDaemon } from '../../daemon.mjs';
|
|
8
8
|
import { stopHappyServerManagedInfra } from '../server/infra/happy_server_infra.mjs';
|
|
@@ -170,7 +170,7 @@ export async function stopStackWithEnv({
|
|
|
170
170
|
const cliHomeDir = (env.HAPPIER_STACK_CLI_HOME_DIR ?? join(baseDir, 'cli')).toString();
|
|
171
171
|
const cliDir = getComponentDir(rootDir, 'happier-cli', env);
|
|
172
172
|
const cliBin = join(cliDir, 'bin', 'happier.mjs');
|
|
173
|
-
const envPath = (env
|
|
173
|
+
const envPath = resolveExplicitStackEnvFilePath(env);
|
|
174
174
|
const selfPgid = await getProcessGroupId(process.pid);
|
|
175
175
|
|
|
176
176
|
// Preferred: stop stack-started processes (by PID) recorded in stack.runtime.json.
|
package/scripts/where.mjs
CHANGED
|
@@ -4,8 +4,18 @@ import { existsSync } from 'node:fs';
|
|
|
4
4
|
import { join } from 'node:path';
|
|
5
5
|
|
|
6
6
|
import { parseArgs } from './utils/cli/args.mjs';
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import {
|
|
8
|
+
getComponentDir,
|
|
9
|
+
getDevRepoDir,
|
|
10
|
+
getHappyStacksHomeDir,
|
|
11
|
+
getRepoDir,
|
|
12
|
+
getRootDir,
|
|
13
|
+
getStackLabel,
|
|
14
|
+
getStackName,
|
|
15
|
+
getWorkspaceDir,
|
|
16
|
+
resolveExplicitStackEnvFilePath,
|
|
17
|
+
resolveStackEnvPath,
|
|
18
|
+
} from './utils/paths/paths.mjs';
|
|
9
19
|
import { printResult, wantsHelp, wantsJson } from './utils/cli/cli.mjs';
|
|
10
20
|
import { getRuntimeDir } from './utils/paths/runtime.mjs';
|
|
11
21
|
import { getCanonicalHomeDir, getCanonicalHomeEnvPath } from './utils/env/config.mjs';
|
|
@@ -52,8 +62,9 @@ async function main() {
|
|
|
52
62
|
const stackName = getStackName();
|
|
53
63
|
const stackLabel = getStackLabel(stackName);
|
|
54
64
|
const resolvedMainEnv = resolveStackEnvPath('main');
|
|
55
|
-
const
|
|
56
|
-
|
|
65
|
+
const explicitEnvPath = resolveExplicitStackEnvFilePath(process.env);
|
|
66
|
+
const resolvedActiveEnv = explicitEnvPath
|
|
67
|
+
? { envPath: explicitEnvPath }
|
|
57
68
|
: null;
|
|
58
69
|
|
|
59
70
|
const { homeEnv, homeLocal } = getHomeEnvPaths();
|
package/scripts/worktrees.mjs
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
getRootDir,
|
|
14
14
|
getRepoDir,
|
|
15
15
|
getWorkspaceDir,
|
|
16
|
+
resolveExplicitStackEnvFilePath,
|
|
16
17
|
resolveStackEnvPath,
|
|
17
18
|
} from './utils/paths/paths.mjs';
|
|
18
19
|
import {
|
|
@@ -615,7 +616,7 @@ async function cmdUse({ rootDir, args, flags }) {
|
|
|
615
616
|
}
|
|
616
617
|
|
|
617
618
|
const workspaceDir = getWorkspaceDir(rootDir);
|
|
618
|
-
const envPath =
|
|
619
|
+
const envPath = resolveExplicitStackEnvFilePath(process.env) || null;
|
|
619
620
|
|
|
620
621
|
if (spec === 'default' || spec === 'main') {
|
|
621
622
|
const repoDir = getDefaultRepoDir(rootDir);
|